|
|
View previous topic :: View next topic |
Author |
Message |
joseph Guest
|
reception RS232 with interruption |
Posted: Thu Apr 05, 2007 3:15 pm |
|
|
Hello,
I've got a problem. I want a script who answer when a RS232 transmission what detected with a interruption. This answer will be a another RS232 transmission. .....
But no answer.... please read my script and tell me what please .
#include <16F877A.h>
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,PARITY=O,STOP=1)
//----------------------------------------
#int_rda
void interruption()
{
PUTC(0x10);
}
//------------------------------------
void main (void)
{
enable_interrupts(int_rda);
enable_interrupts(global);
} |
|
|
Ttelmah Guest
|
|
Posted: Thu Apr 05, 2007 3:24 pm |
|
|
Two things.
You _must_ terminate the 'main', with something like a:
while(true) ;
Otherwise the processor runs off the end of the code, and goes to sleep. Once this has happened, it won't respond to the serial.
Then you really need to read the received character in the interrupt. Otherwise after two characters, the UART will hang, and receive will stop working. A simple 'getc', will d this.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|