My rules:- Don't use Serout when the PIC have an internal USART, use HSEROUT instead.
- use Timer as counter when hardware allow
- keep ISR as short as possible to avoid latency etc etc
In this case, i guess, you could remove the interrupt and do the job by reading the Timer register. Working 'round the multiple if/then statement you can improve it.
also...
Code:
OPTION_REG = %00000000
On Interrupt Goto myint
INTCON = $90
IF PORTA.0 = 1 THEN NINE
LOOP: serOUT PORTC.6,T9600,[#b5,#b4,#b3,#b2,#b1,13]
When you start the PIC and IF PORTA.0=1 you make it jump to the ISR? Bad practice
Bookmarks