OUT ( expression )

When writing to OUT (expression), the pin corresponding to expression will be set a voltage level corresponding to TRUE or FALSE, non-zero or 0.  When setting a pin state with OUT(x) = 0 then the pin becomes low, any other value and the pin becomes high, so OUT(x) =1 and OUT(x) = -1 both set the pin high.

The OUT directive does not change the input/output configuration of the pin. Following reset all pins are inputs, before an OUT () will have an effect on a pin, that pin must be made an output using an OUTPUT command.  The reason for this is to make OUT faster, if the pin direction were changed each OUT, then the speed of one OUT to the next would be slower.

The ARMmite allows control of 24 pins (0..23), with pins 16..23 shared with the AD pins.  On reset or power up the AD pins are configured as AD inputs.  To change those to digital IOs, the user must individually specify a control direction using INPUT(x), OUTPUT(x), DIR(x),  or IO(x) commands.  After that they will remain digital IOs until the next reset or power up.

For the ARMmite, PRO, ARMexpress and ARMexpress LITE these pin numbers correspond to the pin numbers shown in the Hardware Section. The numbering was assigned by physical location on the board. So DIR, HIGH, IN, INPUT, IO, LOW, OUT and OUTPUT use these physical pin assignments. But P0(pin) will use the bit assigned by NXP. Going forward new board designs will maintain the bit assignment from NXP for all keywords.

For the ARMweb, DINkit, SuperPRO, PROplus and PROstart these pin numbers correspond only to the Port 0 assigned by NXP, for instance DIR(10) corresponds to P0(10)

With version 8.11 of the firmware, ports beyond port 0, can be accessed as 32-63 for port 1, 64-95 for port 2, and so on. Or you may use the P1 .. P4 commands .


' Set pin 9 as an output

' Drive pin 9 high
OUT(9) = 1

PRINT "The current value of Output pin 9 is "; OUT(9)

The current value of Output pins is 1

Differences from other BASICs

See also