NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » sending data over serial port at given time intervals
July 28, 2011 by kemil |
Hi All, Im trying to send data over the serial port. But instead of sending it every cycle of the while loop i want to send data every approx seven seconds so i have added an interrupt and an in statement but it hasnt worked. Is there something wrong with my code is it a more fundamental issue to do with printf_P?
|
---|---|
July 28, 2011 by bretm |
"on" needs to be "volatile char" instead of "double". I'd also make "time" a char instead of a double so it only takes one byte instead of four. |
August 10, 2011 by kemil |
Hi bretm, Thanks fro your reply. I tried what you said and it didnt work i then changed 'time' from a char to an int and it now works. on a side note.. what the reason you need to make on a volatile char? would a volatile int/ uint_8 work? thanks kemil |
August 10, 2011 by bretm |
char is a byte, the same as uint8_t. If it only works with int, which is 16 bits, you must be using a value greater than 255 somewhere, which I couldn't tell from the code posted above. |
Please log in to post a reply.
Did you know that reading a double floating point variable with scanf requires "%lf" for "long float"? Learn more...
|