Exponential Operator


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Not sure but...

    Have you looked at the shift functions >> and << around page 32 in the PBP manual?
    row 1 = %0001
    row 2 = %0010
    row 3 = %0100
    row 4 = %1000
    If you want a byte or word to do the above thing this might work:

    X var Byte
    Y var Byte

    Y=1 'Now Y=%00000001
    For x=0 to 6 Step 1
    Y=Y << 1 'Shift Y left one time, Y=%00000010,Y=%00000100,Y=%00001000
    Next x

    This command is also usefull when combining nibbles and other stuff, shift happily left or right as you see fit.
    Last edited by sinoteq; - 26th October 2007 at 04:25.

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Default

    >> I just wanted to convert between #4 and %1000 with a single line of code.

    B0 = DCD 3 ‘ Sets B0 to %00001000

    (see PBP manual for full details)
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    Join Date
    Oct 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default What is PBPL?

    Thank you Sinoteq
    I checked that out.
    I think I can even do this:

    Y=1 'Now Y=%00000001
    x = 6
    Y=Y << x

    And thank you Paul,
    I'll look into DCD.

    By the way, what is PBPL?

    -Andrew

  4. #4
    Join Date
    Sep 2006
    Posts
    18


    Did you find this post helpful? Yes | No

    Default

    It comes with the new PBP 2.50 upgrade.

    PBPL is the new .exe file that lets you use 32 bit variables (only on the 18FXXX series).


    You can use negative numbers without having to use two's complement; you can use * + / - operators with 32 bit.

    DIG and other instrucctions are "enhanced" by it.

  5. #5
    Join Date
    Oct 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Lightbulb New Math Problem

    Now what I want to do is go backwards from what I did before.

    What would be a good equation/function for:

    Given a = %00100
    b should equal 2


    %00001 = 0
    %00010 = 1
    %00100 = 2
    %01000 = 3
    %10000 = 4

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    andrewroz, Use the NCD function. It will give you the value of the most significant bit set.
    It's in the manual.....

    Dave Purola,
    N8NTA

  7. #7
    Join Date
    Oct 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Ncd

    Cool,
    Thanks Dave.
    -Andrew

  8. #8
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by andrewroz View Post
    Thank you Sinoteq
    I checked that out.
    I think I can even do this:

    Y=1 'Now Y=%00000001
    x = 6
    Y=Y << x

    And thank you Paul,
    I'll look into DCD.

    By the way, what is PBPL?

    -Andrew
    PBPL = PicBasic Pro Libraries ???

  9. #9
    Join Date
    Sep 2006
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Pbpl = ???????????

    PBPL it's the name of the compiler that uses long format:

    PBPL = PIC Basic Pro LONG

Similar Threads

  1. what is objective of this operator "*/" ?
    By iugmoh in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th April 2008, 03:43
  2. Exponential
    By civicgundam in forum General
    Replies: 8
    Last Post: - 3rd February 2008, 18:19
  3. '*/' operator
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th January 2007, 21:00
  4. math operator LOG
    By Eyal in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd July 2004, 00:45
  5. Log and exponential
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th March 2004, 21:03

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