Shop OBEX P1 Docs P2 Docs Learn Events
What is the NOT for multi I/O PINs w/ PropBasic? — Parallax Forums

What is the NOT for multi I/O PINs w/ PropBasic?

$WMc%$WMc% Posts: 1,884
edited 2010-06-06 20:45 in Propeller 1
Hello


·I need to invert the states of a pin group. "LEDs· PIN··15..12 LOW".
"TOGGLE" will do one PIN, I need to invert 4 pins·.

·I need to change this·%1111 to this·%0000


Thanks·in advance for any help

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.

Post Edited ($WMc%) : 6/5/2010 6:19:15 PM GMT

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-06-05 04:09
    Not being a BASIC person, what's wrong with XOR?
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-05 11:00
    Well... we may need to have Bean update the compiler for this. This line *should* work, assuming LEDs is defined as an output group:

    OUTA = OUTA ^ LEDs
    


    ... but the compiler is complaining. So, a quick work-around is this:

    \ XOR  OUTA, LEDs
    


    ... which is what I would expect the compiler to produce for the above line of BASIC. One of the nice things about PropBASIC is that we can work in snippets of Assembly when the compiler doesn't do exactly what we want.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • BeanBean Posts: 8,129
    edited 2010-06-05 13:12
    You guys are trying too hard tongue.gif
    LEDs = ~LEDs
    

    PINs cannot be used with binary operators.

    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
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • $WMc%$WMc% Posts: 1,884
    edited 2010-06-06 17:33
    Thanks JonnyMac
    I keep forgetting that I can use PASM snippets in PropBasic.

    Thanks Bean
    I tried the SPIN NOT "~" before I posted this post and I got a syntax error.I just tried it again and it compiled fine.Hhmm....

    Thanks Again guys

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.·
  • BeanBean Posts: 8,129
    edited 2010-06-06 18:15
    Oh, and actually TOGGLE will work with multi-pin names. It's just that it will also generate code to make the pins outputs too.

    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
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • $WMc%$WMc% Posts: 1,884
    edited 2010-06-06 20:45
    Thanks Bean

    You are the Man. TOGGLE does work for multi pin outputs

    I just needed to put it in the right spot to make the compiler happy.

    I've been going through these exercises to get the hang of the compiler.I'm seeing what the compiler likes and doesn't like. I use pin masks a lot,So I wanted to really understand this with PropBasic. I think I have a good understanding on it now.I can flip-flop invert etc.and it all works like I want.

    Thanks Again


    Next is SERIN/SEROUT w/ PropBasic

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.·
Sign In or Register to comment.