PDA

View Full Version : What is the NOT for multi I/O PINs w/ PropBasic?



$WMc%
06-05-2010, 11:06 AM
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

kuroneko
06-05-2010, 11:09 AM
Not being a BASIC person, what's wrong with XOR?

JonnyMac
06-05-2010, 06:00 PM
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

Bean
06-05-2010, 08:12 PM
You guys are trying too hard http://forums.parallax.com/images/smilies/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. [RUSH - Freewill]

$WMc%
06-07-2010, 12:33 AM
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.·

Bean
06-07-2010, 01:15 AM
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. [RUSH - Freewill]

$WMc%
06-07-2010, 03:45 AM
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.·