does PicBasic do that?


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45

    Default does PicBasic do that?

    When I store a floating point number( such as 1,5 or 1.5) Picbasic erase the numbers after comma

    is it picbasic's fault or Pic's fault??
    Electrical & Electronic Engineering
    Undergraduate Student

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Talking

    No,

    Just programmer's fault who hasn't read his manual at all ...

    Where did you find PbP was using directly floating point numbers ??? Probably on another forum.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HYETİK View Post
    When I store a floating point number( such as 1,5 or 1.5) Picbasic erase the numbers after comma
    Store your 1.5 as 15 (or 15,0) and your float will float with picbasic.

  4. #4
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    I think I couldn't explain my problem
    I know this because of my poor english...

    When I store 655/10 to a variable and I write it in lcdout command it shows only 65

    I thought that pbp shows only number that are located before comma but when I product this variables with 100, at this time it showed 650

    Did you understand now?? I'm so bored, I tend to give up using pbp...
    because I saw that I can set variables as double or float in pic c...
    I don't want to stop using pbp heeelllppp...!!!!


    my pbp version:2.47
    mcs version 3.0.0.0
    Electrical & Electronic Engineering
    Undergraduate Student

  5. #5
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    I designed a code that takes a numeric variable such as 12.34. But when I put it a var. picbasic takes it as "12" !!!

    Anybody can solve this problem??
    Electrical & Electronic Engineering
    Undergraduate Student

  6. #6
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    in other word;

    how can I define double var. and use it in picbasic freely??
    Electrical & Electronic Engineering
    Undergraduate Student

  7. #7
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    I comprehend that I must use 12.34 as 1234 and when I am using I must divide it 100.....


    Problem solved I wish I use 12.34 directly but....

    Thanks
    Electrical & Electronic Engineering
    Undergraduate Student

  8. #8
    Join Date
    Jan 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HYETİK View Post
    I comprehend that I must use 12.34 as 1234 and when I am using I must divide it 100.....


    Problem solved I wish I use 12.34 directly but....

    Thanks
    PBP has the FP library. I gave it 1/2 a try years ago and got nowhere. Found the multiply by 100 and MODs worked just fine.

  9. #9
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you read the PBP Manual you will discover it only handles INTEGERS.

    If you have a BYTE, your numbering is 8 bits from 0-255 (NO DECIMAL PLACES)...

    If you have a WORD, your numbering is 16 bits 0-65535 (NO DECIMAL PLACES)...

    If you lave a LONG etc etc the rest is in your documentation.

    Theis does not mean you can't do Floating Point Math, but it means you have to stay within the limitations of the variables that you are using. If you want two decimal places precision example 12.34 then you must store it as 1234 and insert the Decimal Point accordingly when you need to Display or Print your variable.

  10. #10
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    thanks Melanie I did it as you said
    Electrical & Electronic Engineering
    Undergraduate Student

Similar Threads

  1. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31
  2. Picbasic VS C Compiler
    By koossa in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th October 2005, 21:44
  3. Replies: 22
    Last Post: - 12th July 2005, 17:39
  4. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 10:04
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 21:19

Members who have read this thread : 1

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