Has anyone tried AI with PICBASIC


+ Reply to Thread
Results 1 to 40 of 104

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,124

    Default Re: Has anyone tried AI with PICBASIC

    yes sure, I changed "0" to 48 and everything works fine.
    The question is, from where it took "0", is there any programming language that can make ASCII to decimal conversion that way?

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133

    Default Re: Has anyone tried AI with PICBASIC

    In every language "0" is equal to 48 dec. or "1" equal to 49, etc.

    Ioannis

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

    Default Re: Has anyone tried AI with PICBASIC

    What do you mean you changed "0" to 48 and it worked? I'm sure it worked fine with "0".
    You must stop mixing up the interpreted ZX BASIC with PBP.

    In PBP lingo
    48
    $30
    %00110000
    "0"
    are all representing the exact same thing, just differently for human readability.
    If you were to connect to 8 LEDs to PortB of your PIC and then do PortB = x where x is any of the above they would all result in the exact same thing being displayed on the LEDs.

    So, in your specific example subtracting "0" will subtract the numeric value 48 from the numeric value of the ASCII code for the digit question. This will result a numeric value equal to that of 'the digit'.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645

    Default Re: Has anyone tried AI with PICBASIC

    The question is, from where it took "0", is there any programming language that can make ASCII to decimal conversion that way?
    nearly all can do that, except that in C,C++ etc it would be '0' not "0" [single quotes is a chr 'literal' double quote is a null terminated "string" c-str]
    Warning I'm not a teacher

  5. #5
    Join Date
    Feb 2013
    Posts
    1,124

    Default Re: Has anyone tried AI with PICBASIC

    I'm not mixing, but with PBP

    X-"0" gives syntax error while compiling.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133

    Default Re: Has anyone tried AI with PICBASIC

    I am pretty sure it does not. Compiles just fine because "0" is in fact 48. So if X-48 compiles it will also compile X-"0".

    If course to have correct results you should not mix 0 (zero) with O (capital letter O) because they have different ascii value. But all compile fine.

    Ioannis

Similar Threads

  1. conversion from picbasic to picbasic pro
    By winjohan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st November 2011, 18:00
  2. Proton PICBASIC vs MeLabs PICBASIC
    By Fredrick in forum General
    Replies: 22
    Last Post: - 11th January 2008, 21:51
  3. PICBasic Pro vs Proton PICBasic
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd November 2006, 16:11
  4. picbasic 2.46
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th April 2005, 03:34
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 21:19

Posting Permissions

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