Show Posts
Pages: 1 ... 128 129 [130] 131 132 ... 364
1936  Using Arduino / Programming Questions / Re: Self-modifying code on Arduino? on: August 02, 2013, 09:55:38 am
Quote
With SMC I could write these audio channel constants into the code before executing the loop and save a lot of cycles for data fetching, and also save registers to keep more channel data in the registers.
Why not keep these "audio channel constants" in EEPROM?  Will reading them from EEPROM going to be any different than reading them from Flash?

That misses the point, constants compiled into the code are inserted into the actual instructions as immediate
constant fields, potentially.  The read-decode-execute hardware is pipelined and costs as little as one cycle per
instruction, whereas accessing EEPROM takes many cycles.

Are these different sets so large and/or diverse that code for each set would be too big to fit yet quickly transferable blocks would not? SMC would have to pick and chose then write that along with the rest of the code to flash --which AVR's can do, just not with existing Arduino bootloader code, AVR-Forth certainly does run-time flash writes-- more efficiently than other ways? I really doubt it.

VLSI Solutions make DSP chips with built-in MCU and GPIO pins. Their programming code is free. Look into a VS1053 breakout board for example, lots of room for customizing and in quantity the chips are economic. You can shoehorn a project into something tight but that doesn't necessarily make the best product and certainly not the best use of development resources. Chances are they may have something that does the job or close and modifiable.

VLSI Solutions in a Finnish company BTW, with very good engineers and help.

1937  Using Arduino / Programming Questions / Re: Help Please! Can someone check the source code of my program please? on: August 02, 2013, 06:34:02 am
I don't expect any big problems with the code and hardware, what could go wrong?
1938  Using Arduino / Programming Questions / Re: Help Please! Can someone check the source code of my program please? on: August 02, 2013, 05:21:54 am
yes the ammonia is in an enclosed refrigeration system so the pressures on that table will always correspond to the temperature or it will be so close that the difference is irrelevant. all I will be doing is instead of converting the output voltage to the corresponding pressure, I will just convert it to the corresponding temperature. That will make the program more manageable considering the compressors plc outputs the temperature to an lcd.

Do you still not know what voltage corresponds to what temperature? Do you know the range fo voltages the pressure sensor will give for what range of pressures it will cover? I doubt that it is for the whole range of those tables.

If there's a nice equation, that would be best but be aware that you can put a lot of lookup data in a table in flash memory, 1024 floats only takes 4k bytes where UNO has 32k flash for code and data. Chances are that your code won't take half of that. Conversion can be as simple as reading a table location. That would be a bite in itself if you don't know how, chew it well before swallowing.

1939  Using Arduino / Programming Questions / Re: Help Please! Can someone check the source code of my program please? on: August 02, 2013, 12:37:21 am
You can ask at the main site. I feel no need to especially after having a look. Those guys are refrigeration pros.

1940  Using Arduino / Programming Questions / Re: Self-modifying code on Arduino? on: August 02, 2013, 12:21:33 am
If there's enough room in a core, a Propeller might be a good choice as well. The code you load is from off-chip and can be determined at run time.
1941  Using Arduino / General Electronics / Re: converting 5v to 12 V on: August 02, 2013, 12:07:57 am
Is that what the ULN2xxx Darlington Arrays have?


The unl2 are paired up of 2 regular npn transistors for a high gain output ...

That's not the whole circuit according to the maker and EE's I have known.
1942  Using Arduino / Programming Questions / Re: Self-modifying code on Arduino? on: August 01, 2013, 09:41:48 pm
You should make a study of Finite State Machines and C pointers, especially function pointers as well. Combine the two or just stick to state machines and your execution path can be totally responsive to events and process state. There's about nothing that SMC can do that beats that.

Quote
I could store some of the constant values for given iteration of the loop into immediates that I otherwise have to fetch from memory.

OTOH I could be the one that doesn't know what you mean by SMC instead of you.

Perhaps if you start with telling what you are trying to do and how you expect to get there using SMC?
1943  Using Arduino / Programming Questions / Re: Two Potentiometer Arduino to xbee to xbee to Arduino to two Led's on: August 01, 2013, 09:32:21 pm
Hi Ben, is Ben just once okay?

I see what you are trying to do and you're not far off the mark. One thing that would help is if you print the incoming bytes as HEX (separated by printed spaces) and put in a newline before printing a SYNCH byte. that way your printed data won't run together.

It would probably not be a bad idea to turn the data into ASCII text or BCD digits that allow more checking than raw binary.

As far as reading incoming data, always check that bytes are available before reading them.

if (Serial.available()) will be true if there is only 1 byte so that test is not good to read 2 bytes.

You're better off checking for and reading 1 byte per pass through loop() anyway, most times there will be no bytes to read, the Arduino could be doing something else like watching for user input or blinking the pin 13 led to show working status.

You should be reading (in HEX) FE data FF data FE data FF data ..... where data is a hex value from 00 to FD. You will need to print leading zeros for data bytes less than 0x10. Do that just to see what you're getting from the transmit.

Set up a state variable with some rules like:

state 0 expects FE. if FE then change state to 1 else change state to 100 (=error)

state 1 expects a data byte in range 0 to FD. if good then process data and change state to 2 else state = error

state 2 expects FF..............

state 100, error, read until you get an FE then set state = 1.

Every time you get a byte and process according to state, return to run loop again. You only process state after reading a byte.

And that is where I set up a BlinkWithoutDelay to serve as a working status indicator.

1944  Using Arduino / Programming Questions / Re: Two Potentiometer Arduino to xbee to xbee to Arduino to two Led's on: August 01, 2013, 09:02:59 pm
Serial data is NOT guaranteed to be delivered. What are you going to do when one of the bytes gets lost?

You seem to have a misunderstanding of what data each sensor sends. Each sends ONE byte (not two or three) per iteration of loop.

Code:
if (Serial.available()) {   // are there any bytes available on the serial port ???
Serial.available() returns the number of bytes available, not TRUE or FALSE. Do NOT use it like it returned TRUE or FALSE.

What IS your problem?

Gee Paul, calm down. 0 bytes = 0 which also = FALSE while 1 or more is non-zero = TRUE.

That's the test that I use and it has never failed me.
1945  Using Arduino / Programming Questions / Re: Self-modifying code on Arduino? on: August 01, 2013, 08:58:30 pm
What do you expect to get out of SMC that you can't get from data-driven code, perhaps a set of state machines?
1946  Using Arduino / Programming Questions / Re: Help Please! Can someone check the source code of my program please? on: August 01, 2013, 08:55:43 pm
Perhaps being in some part of a closed refrigeration system would do that?
1947  Using Arduino / General Electronics / Re: converting 5v to 12 V on: August 01, 2013, 08:17:43 pm
Is that what the ULN2xxx Darlington Arrays have?
1948  Using Arduino / Programming Questions / Re: Help Please! Can someone check the source code of my program please? on: August 01, 2013, 08:15:08 pm
That table seems pretty deterministic.
1949  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 01, 2013, 12:03:37 pm
TTL serial is one of those things where the state of the wires is inverted to what I expected. OFF is HIGH.

1950  Using Arduino / General Electronics / Re: converting 5v to 12 V on: August 01, 2013, 11:57:51 am
I paid $3.50 for a 12V 1A wall wart...
Pages: 1 ... 128 129 [130] 131 132 ... 364