USART, I2C, EERAM read/write, port setup, ISR, and full initialization sample from Tony Kübek of Flintab AB [tony.kubek at flintab.com]
JAL Interrupts@, Ubicom SX Interrupts@,
hello....i wrote a normal interrupt routine for pic18f452.But it doesn't seem to work.Is there any problem with my save and restore context?Can any one help?Thx
in_serv: MOVWF W_SAVE ; save W SWAPF STATUS, W ; save STATUS MOVWF STATUS_SAVE uart_ready btfss PIR1,RCIF ;; 5 goto Main ;if not ready, wait... movf RCREG,W ;recover uart data bsf LATB,3 ;light RB3 led movwf rx_data ;save for later bsf INTCON,7 ;re-enable interrupts SWAPF STATUS_SAVE, W MOVWF STATUS ; restore W and STATUS SWAPF W_SAVE, F SWAPF W_SAVE, W retfie
James Newton replies: First, I would recommend you check Olins templates and the Microchip sample code. Second, what is wrong? What actually happens when you try the code?+
How can I save the data memory bank during a interruption if I'm using a 16f873 that does not have the registers mirrowed in the upper memory. Thanks Matteo
You can't save the entire data memory bank to somewhere else, because there is nowhere else.
However, you can save away the bits that indicate which data memory bank is the "current" data memory bank. (The BANKSEL command sets those bits). Those bits are in the "status" register.
Try the standard Saving/restoreing registers code. That code already saves (and later restores) the "status" register. -- David Cary 2005-12-31
Hi I am having trouble geting the interrupts working for the PIC16f628. It seems to go to the interrupt once only. i tried checking the toie flag, as it should toggle between 1 and 0, but it does. Any ideas anyone??? Thanks, Charlene
Are you sure the global interrupt enable bit is "enabled"?
Does the interrupt routine end with RETFIE (return from interrupt) ? (Ending an interrupt routine with a "normal" RETURN or GOTO doesn't work -- those would cause the "only interrupts once" problem). -- David Cary 2005-12-31
|file: /Techref/microchip/ints.htm, 5KB, , updated: 2018/9/4 13:41, local time: 2023/3/27 13:43,
|©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.sxlist.com/Techref/microchip/ints.htm"> PIC MicroController, PIC Interrupt Routine Library</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!