Menu

timer 4

Help
2019-11-11
2019-11-12
  • Jim giordano

    Jim giordano - 2019-11-11

    I was using timer2 with the following code-

    On interrupt Timer2Match call showtimex
    Inittimer2 6, 2
    StartTimer 2
    

    and everything works perfectly. I wanted to change to timer4 so I changed the code to

    On interrupt Timer4Match call showtimex
    Inittimer4 6, 2 
    StartTimer 4
    

    but it never triggers the interrupt. Is there something special you need to do for timer4?

    I tried on both a 16F1938 and 16F18856 with the same results.

    GCB version:
    ;Program compiled by Great Cow BASIC (0.98.06 2019-06-12 (Windows 32 bit))

     
  • Anobium

    Anobium - 2019-11-12

    My guess... you have optimsed the code and not enabled those timers.

    #option Explicit
    #chip 16F18856, 32
    
    On interrupt Timer4Match call showtimex
    Inittimer4 6, 2
    StartTimer 4
    
    sub showtimex
    end sub
    
    
    'Optimise code
        #define USE_Timer0 false
        #define USE_Timer1 false
        #define USE_Timer2 true
        #define USE_Timer3 false
        #define USE_Timer4 true
        #define USE_Timer5 false
        #define USE_Timer6 false
    

    Seems to work in the simulator.

     
  • Jim giordano

    Jim giordano - 2019-11-12

    Duh.

    I was definately doing too many things at the same time yesterday.

    I haven't said it enough, but

    THANK YOU EVAN,

    for all your patience and expertise.

     
  • Anobium

    Anobium - 2019-11-12

    I got my crystal ball out and guessed what you did... from another unrelated post!

     
  • Anobium

    Anobium - 2019-11-12

    @Jim. I was making a joke! :-)

     
  • Jim giordano

    Jim giordano - 2019-11-12

    ?? Everything you said seemed okay to me. You were the one that told me about the "use_timerx false", I just forgot it was there at the end!

     

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.