1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    I have an update on this issue.
    In my ISR I have interrupts created by timer 1 and timer 3. Timer 1 is used as a one-shot timer and timer 3 is used as the low frequency 1Hz generator.

    Timer 1 and timer 3 are identical peripherals, so I have simply renamed timer 1 registers to timer 3 registers and vice versa, and now the code works well on 26k22 as well as 25k22, with timer 1 running the 1 second epoch code.

    The only difference between timer 1 and timer 3 is that they use different peripheral interrupt enable registers, maybe there is an issue with that ?

    Chris

  2. #2
    Join Date
    Nov 2008
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    Hi Chris

    I had this problem on a 24k22, turned out to be the TxRD16 bit of TxCON being set for 16bit mode. Changing this to 8 bit mode solved it for me.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    Quote Originally Posted by BH_epuk View Post
    Hi Chris

    I had this problem on a 24k22, turned out to be the TxRD16 bit of TxCON being set for 16bit mode. Changing this to 8 bit mode solved it for me.
    Hi, thanks for that.
    I did get around to suspecting that and tried changing between 16-bit and 8-bit modes but there was no difference - and I couldn't explain how it would make a difference because the 25k22 and 26k22, which use identical registers.

    The only difference between the two timers seems to be that they use different interrupt registers, not between devices though, so I still can't quite explain how the fault occurs

  4. #4
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    232


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    Chris,
    I am trying to make the leap from 16F’ to 18F’s. I want to start with the 18F25k22. Would you mind sharing some 25k22 code? I would be interested in what your config’s look like for your 25k22 clock project?
    Thanks!
    Wayne

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    Hello Wayne,
    there is probably little point in using my configs, unless yoiu plan to set up your pic to mimic mine.
    Your best way top approach it is to decide which peripherals you would like to use first of all, and then look in the MPASM directory for the 18F25k22.inc file. At the end of that file all of the correct mnemonics for the configs are listed.
    I generally copy the ones I want to use from the Microchip include file and put them in the Picbasic 18f25k22.inc include file to enable them.

    Chris

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    Hi,
    Just a reminder that this has changed in PBP3, if that's what you have. There's no longer any need to edit .inc files etc, instead use #CONFIG/#ENDCONFIG to override the defaults. Also take a look a the DEVICE_REFERENCE folder of the PBP install folder, there you'll find a .INFO file for each supported PIC outlining the available configs etc. The .INFO is just a plain text file so you can open it Notepad or MCSP or whatever.

    For example, here a config block for the 18F25K22 on a project of mine (requires PBP3)
    Code:
    #CONFIG
        CONFIG FOSC = HSMP
        CONFIG PLLCFG = ON
        CONFIG PBADEN = OFF
        CONFIG MCLRE = EXTMCLR
        CONFIG LVP = OFF
        CONFIG XINST = OFF
    #ENDCONFIG
    Obviously this doesn't contain ALL the CONFIGs - just the ones I was currently interested in. Again, very easy and flexible, no need to edit files etc.

    /Henrik.

  7. #7
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    232


    Did you find this post helpful? Yes | No

    Default Re: 1Hz clock using Timer3, 32.768kHz crystal and runs badly on 18F26k22

    Thank you Chris and Henrik for your comments.

    I am using MCSP, PBP 2.60c, and MPLAB8.83. When I compile from MCSP I get a statement “18F25K22.INC not found”, in addition to other errors. In PBP I have three files for 18F25K22. 18F25K22.INC, 18F25K22.Visual Basic Module, 18F25K22.BAL are in C:\PBP.

    There is NO M18F25K22.INC in C:\PBP\INC.

    If I understand what you are saying, I should copy the P18F25K22.INC from C:\Microchip\MPASM Suite into PBP\INC. Is that correct? If so, should I call it M18F25K22?

    I also find in C:\Mecanique\MPASM has INC files. There is NO P18F25K22 in this folder. Should there also be a P18F25K22 file in this folder?

    Thank you for your help. I’ve been working with this for several days, reloaded all my programs and updating from PBP2.60, 2.60a, 2.60c. My forehead feels like mister-e’s after banging the keyboard for hours!
    Wayne

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