incrementing 16 bit timer value


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108

    Default incrementing 16 bit timer value

    I have TMR1 loaded with $FC7C, using the commands TMR1H=$FC and TMR1L=$7C.

    I was hoping to make this one variable like T1Val=$FC7C so that I can increment or decrement this timer value. Can this be done? Can I concantenate both bytes as in T1Val=TMR1H +TMR1L (where T1Val var word)?

  2. #2
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: incrementing 16 bit timer value

    Sure you can do what you want.

    T1Val var word
    T1Val = $FC7C

    TMR1L = T1Val.BYTE0
    TMR1H = T1Val.BYTE1
    Regards,
    TABSoft

  3. #3
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: incrementing 16 bit timer value

    So I can write: T1Val=T1Val+1 resulting in T1Val incrementing from FC7C to FC7D?

  4. #4
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: incrementing 16 bit timer value

    Yes.

    The "Using Scaler Variables" section in the PBP manual describes this.

    You can do this:

    T1Val = $FC7C
    T1Val = T1Val + 1 ' $FC7D

    TMR1L = T1Val.BYTE0 ' $7D
    TMR1H = T1Val.BYTE1 ' $FC

    Timer1 now equals $FC7D
    Regards,
    TABSoft

Similar Threads

  1. Incrementing Upper Nibble Only (HighNibble)
    By Zebryk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th March 2015, 23:33
  2. Stopping a roll over when incrementing a count
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th May 2011, 23:06
  3. Writing 16 bit numbers to timer 1
    By bison_bloke in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th March 2010, 12:01
  4. Automatically incrementing version counter/variable
    By skimask in forum PBP Wish List
    Replies: 4
    Last Post: - 5th December 2008, 06:00
  5. Incrementing Help
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2005, 22:57

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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