MemOut Statement
Simultaneously sets 8 memory I/O bits.
Syntax
MemOut portNumber, outData
Parameters
- portNumber
- Specify the memory I/O byte port number. The portNumber selection corresponds to the following:
Port Number Outputs 0 0-7 1 8-15 ... ... - Outputs
- Specify the output pattern for the output group specified by port number as an integer value from 0 to 255. If represented in hexadecimal form the range is from &H0 to &HFF. The lower digit represents the least significant digits (or the 1st 4 outputs) and the upper digit represents the most significant digits (or the 2nd 4 outputs).
Description
MemOut simultaneously sets 8 memory I/O bits using the combination of the portNumber and outData values specified by the user to determine which outputs will be set. The portNumber parameter specifies which group of 8 outputs to use where portNumber = 0 means outputs 0 to 7, portNumber = 1 means outputs 8 to 15, etc. Once a portNumber is selected, a specific output pattern must be defined.
This is done using the outData parameter. The outData parameter may have a value between 0 and 255 and may be represented in hexadecimal or integer format. (i.e. &H0 to &HFF or 0 to 255)
The table below shows some of the possible I/O combinations and their associated outData values assuming that portNumber is “0”, and “1” accordingly.
Output Settings When portNumber=0 (Output number)
outData Value | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
01 | Off | Off | Off | Off | Off | Off | Off | On |
02 | Off | Off | Off | Off | Off | Off | On | Off |
03 | Off | Off | Off | Off | Off | Off | On | On |
08 | Off | Off | Off | Off | On | Off | Off | Off |
09 | Off | Off | Off | Off | On | Off | Off | On |
10 | Off | Off | Off | Off | On | Off | On | Off |
11 | Off | Off | Off | Off | On | Off | On | On |
99 | Off | On | On | Off | Off | Off | On | On |
255 | On | On | On | On | On | On | On | On |
Output Settings When portNumber=1 (Output number)
outData Value | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
---|---|---|---|---|---|---|---|---|
01 | Off | Off | Off | Off | Off | Off | Off | On |
02 | Off | Off | Off | Off | Off | Off | On | Off |
03 | Off | Off | Off | Off | Off | Off | On | On |
08 | Off | Off | Off | Off | On | Off | Off | Off |
09 | Off | Off | Off | Off | On | Off | Off | On |
10 | Off | Off | Off | Off | On | Off | On | Off |
11 | Off | Off | Off | Off | On | Off | On | On |
99 | Off | On | On | Off | Off | Off | On | On |
255 | On | On | On | On | On | On | On | On |
See Also
In, MemIn, InBCD, MemOff, MemOn, MemSw, Off, On, OpBCD, Oport, Out, Sw, Wait
MemOut Statement Example
The example below shows main task starting a background task called “iotask”. The “iotask” is a simple task to toggle memory I/O bits from 0 to 3 On and Off. The MemOut instruction makes this possible using only 1 command rather than turning each memory I/O bit on and off individually.
Function main
Xqt 2, iotask
Go P1
.
.
Fend
Function iotask
Do
MemOut 0, &H
Wait 1
MemOut 0, &H0
Wait 1
Loop
Fend
Other simple examples from the Command window are as follows:
> MemOut 1,6 'Turns on memory I/O bits 9 & 10
> MemOut 2,1 'Turns on memory I/O bit 8
> MemOut 3,91 'Turns on memory I/O bits 24, 25, 27, 28, and 30