Show Posts
|
|
Pages: 1 2 [3] 4 5 ... 42
|
|
34
|
Using Arduino / Programming Questions / Re: Single Clock Delay
|
on: May 04, 2013, 11:57:46 pm
|
Yes I've looked this function in IDA, and here it is: loc_A6: nop adiw r24, 1 ldi r18, 3 cpi r24, -24 cpc r25, r18 brne loc_A6
So 6 instructions that probably takes 7 clocks.. As you said, 440 / 7 = close to 62.5. Sorry then, this function is useless 
|
|
|
|
|
35
|
Using Arduino / Programming Questions / Re: Single Clock Delay
|
on: May 04, 2013, 11:24:53 pm
|
void delayClocks( uint32_t clocks ) { do { __asm( "nop" ); } while ( --clocks ); }
 But, I don't think it will be the correct delay as you expect, I tested it and: delayClocks( 1000000 ) should be a delay of 62.5 milliseconds right? Well on my Arduino it is more like 440 milliseconds...
|
|
|
|
|
36
|
Using Arduino / Installation & Troubleshooting / TX LED stay ON after the Serial Monitor is closed
|
on: May 04, 2013, 06:48:12 pm
|
Hello  I don't know if it's a bug, but in my current program I have a Serial.print that prints some data every seconds in the Serial Monitor. So the TX LED is blinking every seconds, until now everything is normal. But if I close the Serial Monitor, the LED continue blinking for approx 93 seconds, and then stay ON. After a press of the Reset button, the LED is still ON. Only when I unplug the power (from USB), and plug it back, the LED stay OFF as it should. When I reopen the Serial Monitor, the LED starts blinking every seconds again, as should, and the problem always happen like 93 seconds after I close the Serial Monitor. Any idea why? Should I check if Serial.available() before the Serial.print? 
|
|
|
|
|
38
|
Using Arduino / Sensors / Re: 2 pin temp censor
|
on: May 04, 2013, 02:43:09 pm
|
I never tried thermistors but from what I've read, they aren't accurate, even 2 thermistors of the same model, could show different values at the same temperature. So you have to make your own lookup table by using a thermometer (or 2, to be more accurate) and measure the resistance at different temperatures. You could use a sensor such as the DHT22 (they are accurate, I have 2 of them and they show the same temp.) to automatically build a lookup table 
|
|
|
|
|
41
|
Using Arduino / Project Guidance / Re: running servos on a sine wave
|
on: May 04, 2013, 07:10:34 am
|
Hello  And you could calculate that delay with something like this: delay_ms = 3 / sin( angle )
So with this example, when the angle is 90 the delay will be 3 ms until the next servo move (91 or 89) and with for example an angle of 179, the delay will be ~172 ms. I suggest you use microseconds for more accuracy. (Be carefully with angles 0 or 180, it will divide by 0 and your Arduino may explode  ) Oh and don't use delay() or delayMicroseconds() functions, instead look at the "Blink without delay" example to see how to do delays without those blocking functions.
|
|
|
|
|
44
|
Using Arduino / Microcontrollers / Re: Is the whole program uploaded even if only one byte changed?
|
on: May 03, 2013, 07:11:15 pm
|
|
Well you are right, I use a Mega 2560 so can't replace chip (at least not easily) but (sainsmart's) Mega 2560 is like 15$ these days. But still, isn't it possible for the "uploader" (avrdude?) to "download" the current program that is on the chip, compare with the to-be-uploaded and if only few bytes changed only upload those bytes? Is it theorically possible and if yes, why it hasn't been made? It would greatly increase the lifetime of that flash memory right?
|
|
|
|
|
45
|
Using Arduino / Microcontrollers / Is the whole program uploaded even if only one byte changed?
|
on: May 03, 2013, 05:51:30 pm
|
Hello  I'm not sure where to post this question... I am wondering if when I upload a program in which I did only small changes compared to the previous version of that program (changing for example byte a = 2 to byte a = 3), will the whole program be uploaded or just the changes? My real question is, will uploading a program "damage" every memory cells it uses, even if only one memory cell was required to be changed? Considering "memory supports at least 10,000 writes or upload cycles"... I'm already at 2000+ uploads I think, and I haven't even done 10% of the code for my project, just testing things...
|
|
|
|
|