Menu

Using internal 32768 oscillator for timer1 on 16LF18324, etc.

2019-04-25
2019-04-27
  • Jim giordano

    Jim giordano - 2019-04-25

    I have been trying to get timer1 to use the internal 32768 oscillator on chip 16lf18324.

    I used:
    InitTimer1 LFINTOSC,0
    but it wasn't working, it was using the FOSC or FOSC4 oscillator for timer 1.

    After screwing around for several hours, I found that I had to manually set

    tmr1cs0=1
    tmr1cs1=1

    to get it to work.
    This is probably a problem with the remainder of this class of microprocessor.

    Perhaps this is a chipdata problem?

     

    Last edit: Jim giordano 2019-04-25
  • Jim giordano

    Jim giordano - 2019-04-26

    Correction. LFINTOSC is not 32768, it's a 31K oscillator.

     
  • Anobium

    Anobium - 2019-04-27

    @Jim.

    Just catching up on this as i have been away.

    I tested with this code.

    #chip 16f18324
    #option Explicit
    InitTimer1 LFINTOSC,0
    

    This corrected issued an error message. As LFINTOSC is not explicitly declared. Which is correct as it is not in the latest library. This needs to resolved. Did you get this message?

     
    • Anobium

      Anobium - 2019-04-27

      @Jim. Please test the attached.

      I have added LFINTOSC support within Timer1 support.

       
  • Jim giordano

    Jim giordano - 2019-04-27

    Yes! It works. Thanks Evan :)

    ( But don't forget timer3 and timer5 )

    This corrected issued an error message. As LFINTOSC is not explicitly declared. Which is correct as it is not in the latest library. This needs to resolved. Did you get this message?

    I don't use #options explicit (it drives me crazy when I'm trying to quickly try some changes, etc) so I didn't get the message. I'll try to remember this in the future if I have problems.

     

    Last edit: Jim giordano 2019-04-27
    • Anobium

      Anobium - 2019-04-27

      @Jim. Ok. I will adapt and move to t3 and t5. Will you retest?

      Always use #option explicit. It is the safe way.

       
  • Jim giordano

    Jim giordano - 2019-04-27

    yes, of course :)

     
  • Jim giordano

    Jim giordano - 2019-04-27

    Looks good. Here's the program I used to test.

     
  • Anobium

    Anobium - 2019-04-27

    Excellent.

    Looks good.

    Please use that going forward. I will include in the next release.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.