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 CCS Technical Support

interrupt poblem

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







interrupt poblem
PostPosted: Mon Apr 17, 2006 4:59 am     Reply with quote

Hello,

I'm a complete newbie in programming PICs, I started with them a few weeks ago, so I'm sorry if my question seems to basic for most of you, but here we go:

I'm working with a 18f8722, but I'm not able to make the rda interrupt work properly. As soon as I enable the interrupt the program goes crazy and does nothing more. Before I enable the interrupt I clear it, and I clear the RCREG register too, but that doesn't seem to be enough. What am I doing wrong or what am I forgeting?

Another problem, which have nothing to do with the previous one, is that a program that I made seems to work perfectly with one of the rs232 ports in the PIC, but when I try the same program with the other port (using in this second port the same configuration as in the other one) it doesn't work. Are there any differences between both ports? I couldn't find any in the datasheet, but as stated before, I'm a newbie, and I may well be skipping something.

Help with any of those problems will be appreciated.

Thank you.
Ttelmah
Guest







PostPosted: Mon Apr 17, 2006 6:27 am     Reply with quote

What is the receive data line 'idling' at?. This must idle 'high', or you will get an interrupt every character time continuously.
Second, you must read the character inside the interrupt routine, or the interrupt will continuously be re-called.
Does you handler have any ability to handle 'overrun errors'?.
Add the 'ERRORS' statement to the RS232 setup, if it is not already there. If you are reading RCREG yourself, rather than using getc with 'ERRORS' enabled, and the overrun error is set, you have to turn off the UART, and re-enable it, to clear this condition. I'd suggest adding the ERRORS statement, and reading RCREG, by using 'if kbhit', and if a character is present calling a dummy getc, which will clear this error.

Best Wishes
Hernán
Guest







PostPosted: Mon Apr 17, 2006 8:17 am     Reply with quote

How do I know if the receive data line idles high or low? I didn't configure that, so I suppose it's default now, but really have no idea about it.
Ttelmah
Guest







PostPosted: Mon Apr 17, 2006 8:51 am     Reply with quote

Depends on the hardware you have attached.
No one else can know.
Basically if you have an incoming RS232 line, this requires an inverting line receiver, to change it to TTL serial, which the chip expects. If the source is already 'TTL serial', you have to check the manufacturers data sheet to find out which logic level the serial is using.

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