I never thought I'd need to set ADCON1 since I'm not using any of PortA.
Learning something new every day. As always, thanks for the help.
I'm going to try your method of toggling the LED's Skimask, never seen it done like that, Thanks.
New working code with one minor change. (Thanks Bruce.)
Code:':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 'Hserin with Darryl Taylor's Instant Interrupts ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ' Program to echo incoming serial data ' Baudrate : 9600 Baud ' MCSP and MPASM, LabX-2, Microcodeloader, PBP2.50 ' Using PIC 18F2525 @ 4MHZ and bootloader ' Using internal USART and MAX232 to interface to Hyperterminal on PC DEFINE LOADER_USED 1 DEFINE OSC 4 DEFINE HSER_RCSTA 90h ' enable serial port, define HSER_TXSTA 24h ' enable transmit, define HSER_SPBRG 25 ' set baudrate to 9600 DEFINE HSER_CLOERR 1 ' automatic clear overrun error TRISC = %10000000 ' PORTC.7 is the RX input, PORTC.6 is the TX output ' Serial communication definition ' =============================== ' ADCON1 = %00001111 'Set up ADCON1 register no matter what you're doing!!!!!! ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: INCLUDE "MODEDEFS.BAS" ' Include Shiftin/out modes INCLUDE "DT_INTS-18.bas" ' Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ' Variable definition ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: RCIF VAR PIR1.5 ' Receive interrupt flag (1=full , 0=empty) TXIF VAR PIR1.4 ' Transmit interrupt flag (1=empty, 0=full) led var PORTB.0 led1 var PORTB.1 led2 var PORTB.2 holdoff var word SerialData var byte clear '((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))) ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RX_INT, _Getbytes, PBP, no endm INT_CREATE ; Creates the interrupt processor ENDASM @ INT_ENABLE RX_INT ; enable RX_INT interrupts '((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))) ' Subroutine to slow loop down some and toggle heartbeat '((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))) Mainloop: for holdoff = 1 to 1000 pause 1 next holdoff toggle led 'toggle led every loop for heartbeat goto Mainloop '((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))) 'ISR for RX_int interrupt '((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))) Getbytes: While RCIF = 1 ' clear the buffer HSERIN 100,error,[Serialdata] ' take it hserout [serialdata] ' send it Wend toggle led2 'led to confirm program went to RX ISR @ INT_RETURN error: Toggle led1 @ INT_RETURN end




Bookmarks