Timer interrupt 16F1827


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1

    Question Timer interrupt 16F1827

    Hello,

    I tried to copy over the interrupt register saving routines used on other 16F MCU's to the 16F1827
    but it is not cooperating

    I am getting errors of "symbol not previously defined" for T1CON.0 , PIE1.0 and PIR1.0 in addition
    to "missing argument(s)"....what is going on?

    See below


    [ code]
    myint

    movwf wsave ; these commands are necessary to preserve registers to prevent
    swapf STATUS, W ; corruption
    clrf STATUS
    movwf ssave
    movf PCLATH, W
    movwf psave




    ; Save and restore FSR and any other registers used
    bcf T1CON.0 ; stop timer 1
    bcf PIR1.0 ; clear over flow flag
    movwf 00h ; load timer for 16,535 * 8 prescaler interrupt on 16 bit timer
    movf TMR1H,W
    movf TMR1L,W
    bsf T1CON.0 ; re-enable timer 1
    bcf PIE1.0 ; clear overflow flag just in case


    ; Restore saved registers
    movf psave, W ; reload system register to previous values before interrupt was called
    movwf PCLATH
    swapf ssave, W
    movwf STATUS
    swapf wsave, F
    swapf wsave, W
    retfie ; Return from interrupt

    endasm
    [ /code]

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do not think that chip is supported by PBP.
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Talking

    Actually, it is supported. I just dug through the Microchip manual and found that it automatically saves
    the registers and does not need to preserve anything manually. I will try it out and let you all
    know how that works.

  4. #4
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    You don't actually have the chip do you? I thought those were not supposed to be out for a couple months?

    Edit: Sorry, I was thinking of the 12F1822 .... waiting .... waiting...
    Last edited by ScaleRobotics; - 23rd July 2010 at 02:15.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    This one has been supported for some time now. I posted a code example for using the data signal modulator a while back for transmitting IR using the onboard USART here: http://www.picbasic.co.uk/forum/show...4227#post84227
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6


    Did you find this post helpful? Yes | No

    Unhappy still not working

    OK, this is very strange. I can not do bit wise manipulation within the inline ASM to
    T1CON.0 , PIE1.0 and PIR1.0 it does not like this syntax. gggrrrr
    Last edited by Macgman2000; - 23rd July 2010 at 00:23.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Make sure you're in the correct register banks, and it should work just fine. Show whatever code you're having issues with, and someone can probably offer help.

    PIE1 is not in the same register bank as the rest of the registers you're writing to.
    Last edited by Bruce; - 23rd July 2010 at 01:32.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8


    Did you find this post helpful? Yes | No

    Question

    Hello Bruce,

    I am not doing anything that didn't work for the 16F877A. The compiler returns errors for this
    code segment. These are the items it returns errors for...T1CON.0 , PIE1.0 and PIR1.0

    See below.

    [ code]
    ASM
    myint


    ; Save and restore FSR and any other registers used
    bcf T1CON.0 ; stop timer 1
    bcf PIR1.0 ; clear over flow flag
    movwf 00h ; load timer for 16,535 * 8 prescaler interrupt on 16 bit timer
    movf TMR1H,W
    movf TMR1L,W
    bsf T1CON.0 ; re-enable timer 1
    bcf PIE1.0 ; clear overflow flag just in case

    retfie ; Return from interrupt

    endasm

    [ /code]

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts