Hello everyone. New BS user here. I have experience in basic programming and started using the basic stamp 2 recently. I have been experimenting around with it and wondered if I could output 1’s and 0’s from groups of pins simultaneously with one command line. I understand how to do that with OUT and the other set ups for input and output control. But I am interested in using a variable to represent the ports P15..P0 to set them hi or low in the command line instead of individual pin states.
Instead of this
DIRS = %0000000000001111 ' make pins 0 - 3 outputs
OUTS = %0000000000001111 ' make pins 0 - 3 high
I would like to have something like this:
A Variable called Ports to represent the ports “0000000000001111” (P15..P0)
To then use a command such as
DIRSports VAR Word ‘represents the target for the DIRS command.
OUTSports VAR Word ‘represents the target for the OUTS command.
DIRSports = 15 ‘decimal for 0000000000001111 output pin directions
OUTSports = 15 ‘decimal for 0000000000001111 output pin states
DIRS = DIRSports ‘make pins P3 – P0 outputs
OUTS = OUTSports ‘sets pins P3..P0 high at the same time
I understand from experimentation that using a variable with DIRS and OUTS as above doesn’t work. Hopefully maybe someone has found a clever way to do something like this. Thanks.