ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Sep 19, 2006 5:44 pm |
|
|
You didn't tell us what is and what isn't working in your new program so I don't know if there is a problem, and if yes what to look for.
An improvement to your program is to clear the timer0 before enabling it, change | Code: | Xout=0; //enable 120khz output.
enable_interruptS(INT_timer0);// Timer0 is used to time the duration of the 1ms 120kHz burst. | to | Code: | Xout=0; //enable 120khz output.
set_timer0(0);
enable_interrupts(INT_timer0);// Timer0 is used to time the duration of the 1ms 120kHz burst. |
Some more tips:
- An error in the int_ext routine is that you are testing the value of TxBit before it has been initialized.
- Do you know there exists a standard rotate_left() function similar to your RotateTxData()?
- You are incrementing the boolean variable ext_edge. This ought to work, but using the bit_toggle() function is more to the point and makes for easier reading.
- Add an endless loop at the end of your main() or the processor will execute the sleep processor that the compiler puts there and transmission will stop. |
|