How to make a word as decimal in if then else statement


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Name:  slap.gif
Views: 432
Size:  4.0 KB . . . . . . . . . .
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Jan 2011
    Posts
    8


    Did you find this post helpful? Yes | No

    Smile

    Sorry, i guess i misunderstoot... PicBasic = program language and proton ide is the compiler, or is my mind freaking out with me now ? :P

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    Hi,
    No, your mind is not freaking out but this is not the forum for Proton.

    It's often confusing as there are several BASIC-compilers for PIC available from different vendors, many of them with the phrasing or names like PICBasic.

    It doesn't get easier by the fact the THIS forum (which is for the PICBASIC compiler from MELABS) are hosted by Crownhill which are the developers of the Proton compiler.....

    For Proton specific questions you might have better luck at the Proton forum.

    With that said, and without knowing Proton the DEC modifier (at least in PBP) is used to convert the value contained in a variable to ASCII text in order to print to a display or serial terminal etc. If you do something like Temp = 100 the variable called Temp will contain the value 100. Now you can do stuff like
    Code:
    If Temp > 125 then Goto CoolDown
    If Temp < 75 then Goto HeatUp
    But if you want to display the value of Temp on a display or terminal simply saying LCDOUT Temp (PRINT Temp in your case) will display the letter 'd' because 100 is the ASCII code for 'd'

    In order to display 100 the compiler needs to convert the value 100 into the text '1' '0' '0' and THAT is what the DEC modifier does.

    /Henrik.

  4. #4
    Join Date
    Jan 2011
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Okay thanks a lot. I will figure it out.

    Have a great day!

    Cheers

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