| Electronic Components Datasheet Search |
|
PIC18C658T-E/CL Datasheet(PDF) 187 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC18C658T-E/CL Datasheet(HTML) 187 Page - Microchip Technology |
|
187 / 366 page ![]() 2000 Microchip Technology Inc. Advanced Information DS30475A-page 187 PIC18CXX8 EXAMPLE 17-1: WIN AND ICODE BITS USAGE IN INTERRUPT SERVICE ROUTINE TO ACCESS TX/RX BUFFERS ; Save application required context. ; Poll interrupt flags and determine source of interrupt ; This was found to be CAN interrupt ; TempCANCON and TempCANSTAT are variables defined in Access Bank low movff CANCON, TempCANCON ; Save CANCON.WIN bits ; This is required to prevent CANCON ; from corrupting CAN buffer access ; in-progress while this interrupt ; occurred movff CANSTAT, TempCANSTAT ; Save CANSTAT register ; This is required to make sure that ; we use same CANSTAT value rather ; than one changed by another CAN ; interrupt. movf TempCANSTAT, W ; Retrieve ICODE bits andlw b’00001110’ addwf PCL, F ; Perform computed GOTO ; to corresponding interrupt cause bra NoInterrupt ; 000 = No interrupt bra ErrorInterrupt ; 001 = Error interrupt bra TXB2Interrupt ; 010 = TXB2 interrupt bra TXB1Interrupt ; 011 = TXB1 interrupt bra TXB0Interrupt ; 100 = TXB0 interrupt bra RXB1Interrupt ; 101 = RXB1 interrupt bra RXB0Interrupt ; 110 = RXB0 interrupt ; 111 = Wake-up on interrupt WakeupInterrupt bcf PIR3, WAKIF ; Clear the interrupt flag ; ; User code to handle wake-up procedure ; ; ; Continue checking for other interrupt source or return from here … NoInterrupt … ; PC should never vector here. User may ; place a trap such as infinite loop or pin/port ; indication to catch this error. ErrorInterrupt bcf PIR3, ERRIF ; Clear the interrupt flag … ; Handle error. retfie TXB2Interrupt bcf PIR3, TXB2IF ; Clear the interrupt flag goto AccessBuffer TXB1Interrupt bcf PIR3, TXB1IF ; Clear the interrupt flag goto AccessBuffer TXB0Interrupt bcf PIR3, TXB0IF ; Clear the interrupt flag goto AccessBuffer RXB1Interrupt bcf PIR3, RXB1IF ; Clear the interrupt flag goto Accessbuffer |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |