Shop OBEX P1 Docs P2 Docs Learn Events
ABOUT "DO WHILE..LOOP" for PropBASIC — Parallax Forums

ABOUT "DO WHILE..LOOP" for PropBASIC

caskazcaskaz Posts: 957
edited 2010-04-02 01:34 in Propeller 1
Hi, everyone.

I think that logic is reverse on "DO WHILE..LOOP" for PropBASIC.
I think P16 is on when P0 = low below;
But P16 is on when P0 = high.
Same as DO UNTIL...LOOP.
My mistake?

....
....
P0 PIN 0
P16 PIN 16 LOW
Main:
 P16 = 0
 DO WHILE P0 = 0
    P16 = 1
 LOOP
...


Post Edited (caskaz) : 3/29/2010 4:15:58 AM GMT

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-03-29 05:09
    What's the question? You're not showing the code after the loop so it's hard to give evaluate your program.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • caskazcaskaz Posts: 957
    edited 2010-03-29 05:46
    Sorry, I thought whole program don't need.

    DEVICE P8X32A,XTAL1,PLL16X
    XIN 5_000_000
    P0 PIN 0
    P16 PIN 16 LOW
    
    Program Start
    Start:
    Main:
      P16 = 0
      DO WHILE P0 = 0
        P16 = 1
      LOOP
     GOTO Main
    
     END
    
    



    I think that P16 = 1 during P0 = low.
    But P16 is on during P0 = high.
    I think logic is reverse.

    My thinking is wrong?

    Post Edited (caskaz) : 3/29/2010 10:59:00 AM GMT
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-03-29 11:00
    Looking at the compiled output I would tend to agree -- there seems to be a logic reversal; Bean can fix that quite easily. Another solution is a different bit of code:

    Main:
      P16 = ~P0
      GOTO Main
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • TonyWaiteTonyWaite Posts: 219
    edited 2010-03-29 12:30
    I'm glad to find that there's a bug in the compiler, because I expected this code to work too!

    T o n y
  • BeanBean Posts: 8,129
    edited 2010-03-29 17:34
    Yeah, I'm looking to the problem.
    It should be corrected in the next release of PropBASIC.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • caskazcaskaz Posts: 957
    edited 2010-03-30 05:18
    Bean, Thanks.
    I wait to expect next release.
  • BeanBean Posts: 8,129
    edited 2010-04-01 16:13
    The problem posted above has been fixed in the latest release of PropBASIC available here http://www.fnarfbargle.com/PropBasic/

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • caskazcaskaz Posts: 957
    edited 2010-04-02 01:34
    Bean, Thanks.
Sign In or Register to comment.