CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

reception RS232 with interruption

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
joseph
Guest







reception RS232 with interruption
PostPosted: Thu Apr 05, 2007 3:15 pm     Reply with quote

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







PostPosted: Thu Apr 05, 2007 3:24 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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