PDA

View Full Version : Serial and Port B interrupt



Pic2008
- 6th November 2008, 15:23
I am using PIC16F877 and planning to have serial cable connect to PIC.
PIC will detect the input RB0, which will trigger an asm int to increase a counter variable.

I plan to use SERIN, but then if RB.0 always got interrupt, then SERIN will never get to execute when PC send a command to PIC. In this case, this serial command is lost.

How do I use serial HW interrupt, so it has a higher priority than asm RB.0 INT?

Note that RB.0 will have an interrupt every 10us, and a counter variable is incremented in this ISR. is this possible with a 20MHz crystal? Each asm instruction cycle is 0.2us right?

mister_e
- 6th November 2008, 16:22
Interrupt priority will be the order you will check the interrupt trigger. The built-in USART have a 2 bytes buffer, so could be useful to avoid some data lost.

Depending your baudrate, this could work or not.