Shop OBEX P1 Docs P2 Docs Learn Events
~~ command — Parallax Forums

~~ command

hacksign23hacksign23 Posts: 15
edited 2010-08-13 19:14 in Propeller 1
Well. I just got my Propeller education kit and I was wondering...
In one of the tutorials, it contains this line:
dira[LEDs_START..LEDs_END]~~ 
I assume... dira means set direction from pins LEDs_start to LEDs_END (both variables) but what does ~~ mean?
thanks.

Comments

  • ke4pjwke4pjw Posts: 1,173
    edited 2010-08-12 18:42
    hacksign23 wrote: »
    Well. I just got my Propeller education kit and I was wondering...
    In one of the tutorials, it contains this line:
    dira[LEDs_START..LEDs_END]~~ 
    
    I assume... dira means set direction from pins LEDs_start to LEDs_END (both variables) but what does ~~ mean?
    thanks.

    ~~ used as a post set operator will set all bits high.
  • Roger LeeRoger Lee Posts: 339
    edited 2010-08-12 18:47
    You have probably found the answer by now.

    It is a quick way to set the included pins to output.
    Look in the manual under Unary Operators.
    It sets individual bits of dira to one. -- output --

    hope this helps
  • ihmechihmech Posts: 179
    edited 2010-08-12 18:55
    Check page 53 in your PE book and pages 157, 158 in the Prop manual. If you don't have any of the Prop books, you'll want to get them. The Prop. manual is availible in PDF. I have all of the books except for the hydra manual and they all have been very helpfull to me.

    Good luck!
  • Roger LeeRoger Lee Posts: 339
    edited 2010-08-12 19:00
    The Propeller manual is in the help menu of the Prop IDE.
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2010-08-12 20:00
    A lot of the Propeller documentation uses idiomatic syntax before showing the longer, more descriptive syntax to do the same thing. IMO, this is/has been a bad precedent to set.
  • hacksign23hacksign23 Posts: 15
    edited 2010-08-12 20:04
    Ahhhh. I see. Yea, I have the manual and PE book in pdf. Now I understand. if i looked up the dira command then I probably would have known.
    So for the dira command, ~~ just sets all of the pins within the two variables to high, which dira interprets as set to output, right?


    thank you so much :D
  • Roger LeeRoger Lee Posts: 339
    edited 2010-08-12 21:02
    bingo. you got it. have happy day
  • w8anw8an Posts: 176
    edited 2010-08-13 18:16
    dira[LEDs_START..LEDs_END]~~

    is equivalent to

    dira[LEDs_START..LEDs_END] := 1

    Steve
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-13 18:58
    w8an wrote: »
    dira[LEDs_START..LEDs_END]~~

    is equivalent to

    dira[LEDs_START..LEDs_END] := 1
    It's not (unless LEDs_START == LEDs_END). What you probably mean is
    dira[LEDs_START..LEDs_END] := -1
    
  • w8anw8an Posts: 176
    edited 2010-08-13 19:14
    Oops, yep... thanks for the correction
Sign In or Register to comment.