PDA

View Full Version : Aliasing multiple pins



eshatara
- 25th April 2009, 02:59
I have a very simple question. Can I create an alias for two input pins say:

Switch.0 VAR PortA.0
Switch.1 VAR PortA.1

And then use Switch with Select Case to perform functions based on the setting of the two switchs.

When I try to compile the above code, I get a syntax error.

Thanks...Chris

rsocor01
- 25th April 2009, 03:24
Try replacing the dots by underscores in the variable names like I show you below. I used underscores all the time. I don't think you can use dots in variable names.

Switch_0 VAR PortA.0
Switch_1 VAR PortA.1

Robert

Archangel
- 25th April 2009, 04:33
Or
SWITCH var PortA
then
SWITCH.0
SWITCH.1
SWITCH.2
are valid names of each Bit/Port

Archangel
- 25th April 2009, 04:40
or this way
switch var byte
switch.0 = portA.0
switch.1 = portA.1

sayzer
- 25th April 2009, 09:06
or this way
switch var byte
switch.0 = portA.0
switch.1 = portA.1

OR




Switch VAR BYTE

SW0 VAR PORTA.0
SW1 VAR PORTB.1
SW2 VAR PORTC.3
SW3 VAR PORTD.7


Switch.0 = SW0
Switch.1 = SW1
Switch.2 = SW2
Switch.3 = SW3



:) :>)

eshatara
- 25th April 2009, 14:53
Thanks for the suggestions. What worked well is the first sugggestion,

Switch_0 var Porta.0
Switch_1 var PortA.1

Now I can access the contents of the two switches through Switch.

Thanks again...Chris