i am looking for a way to trigger a interrupt event when i send a serial command to a pic from a pc serial port. i plan on using the serin and serout commands in the program.
i am looking for a way to trigger a interrupt event when i send a serial command to a pic from a pc serial port. i plan on using the serin and serout commands in the program.
Although it is possible to do what you say (if you pick your RECEIVE pin on Port B), I really wouldn't use SERIN/SEROUT. If your device has a hardware serial port - use it. Interrupts are far, far simpler that way.
If you have no hardware serial port, and you absolutely must have an interrupt, I wrote some code 2-3 years ago that gets the job done. It might take me awhile to find it, though.
But do you best to use the hardware first....
Charles Linquist
Thank you for the suggestion. By going with the hardware serial port i would need to use another chip like a max232, right? I have had pretty good luck with serin2 and serout2 in the past; I think i will give the portb interrupt a try.
Not true
Some chips, like the 18F2321 that I like to use for small projects, have two bits (BAUDCON.5 and BAUDCON.4) that let you invert the hardware serial port for both transmit and receive. No MAX232.
Charles Linquist
In this case you need to cautious as the level will not be true RS-232 but still TTL.
Ioannis
Bookmarks