Math operations & Syntax?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kevj View Post
    What is the exact syntax to split off the high and low bits? That really is my confusion at this point. I want to do something like this, but I'm not sure the syntax...

    Code:
    myHolder VAR WORD
    ''' stop timer, which is now holding the result I want to measure
    myHolder (the low byte) = TMR1L
    myHolder (the high byte) = TMR1H
    myHolder = myHolder - 200
    ''' now I'll goto another sub where I'm using the timeout as a trial
    TMR1L = (the low byte of myHolder)
    TMR1H = (the high byte of myHolder)
    So I guess I'm just asking for the syntax of how to reference a high bit or a low bit in or out of a 16-bit variable, and also to clairify that once I have the value in "myHolder", I can do all the simple add/subtract math I want to it just like any normal variable as long as the values remain between 0 and 64,000andwhatever.
    Right? :-)
    It's all in the manual under the "Variables" section, highbyte, lowbyte, bitxxx, aliasing, whatever...

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    These two threads should answer your question & then some. The 2nd using the EXT
    modifier is really nifty.

    http://www.picbasic.co.uk/forum/showthread.php?t=544

    http://www.picbasic.co.uk/forum/showthread.php?t=3891
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Aug 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thanks guys! Much appreciated!

Similar Threads

  1. Resolution integer math assistance?
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th January 2010, 04:01
  2. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 11:22
  3. instruction cycles for math operations
    By Michael Wakileh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th July 2007, 12:03
  4. Math Operations on pbp
    By Jannia04 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th May 2007, 16:33
  5. PIC18Fxx math 24 & 32 bit
    By ronsimpson in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd December 2006, 13:52

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