Announcement

Collapse
No announcement yet.

Stuck with Timer1 on 18F67K40

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stuck with Timer1 on 18F67K40

    I have been battling with Timer1 in the 18F67K40.

    I have it working using PBP however, due to needing to use assembly interrupts, I wish to use interspersed assembler blocks within the main PBP code.

    Using the below code snippet all is well:
    PIR5.0 = 0 ' Clear Timer1 Interrupt flag
    T1CON.0 = 0 ' Turn Timer1 OFF
    TMR1L=0
    TMR1H=1
    TMR1L=10
    Counter = Counter + 1
    T1CON.0 = 1 ' Turn Timer1 ON

    If I try to convert even the first line to assembler as below, it no longer works:
    @ BCF PIR5, 0

    This one has me a bit stumped. Is there something with the bank selection that I have not addressed?

    Regards,

    Andy

  • #2
    Originally posted by Andy Wood View Post

    This one has me a bit stumped. Is there something with the bank selection that I have not addressed?
    since PIR5 is not in bank0 or the access bank then it needs to addressed in the correct bank ie 15


    you could use the

    MOVE?CT macro

    @ MOVE?CT 0 , PIR5 , 0

    or
    BANKSEL PIR5
    BCF PIR5, 0


    not forgetting to restore the bank when you have finished

    Comment


    • #3
      Thanks Richard.

      I'll give it a try and let you know how it goes.

      Can you point me to a resource for more information on the available macros and their use?

      Regards,

      Andy

      Comment


      • #4
        Originally posted by Andy Wood View Post
        .

        Can you point me to a resource for more information on the available macros and their use?
        i'm not aware of anything that details their use or even their existence that has been published, but a good read through your *.lst files yields many clues
        be aware that some macro's will not be available unless certain key pbp functions have been called and compiled into your code prior to use
        and some may not do what you think they may eg RST?RP . take small steps , test everything

        Comment

        Working...
        X