| Online Development Notebook > Index > ODN > Raw Device Programming > 03 - WriteABitCmd |
Command #03 - WriteABitCmd
Description:
Write masked values to port A. The net result of writing masked values is that only the specified bits will be written. The resulting port condition is the logic combination of the current port state ANDed with the first term and then ORed with the second. This command can affect any number of lines on the port.
Command Format:
| Byte Number | Description |
| 0 | 03h: WriteABitCmd |
| 1 | AND term (off term) |
| 2 | OR term (on term) |
| 3 | <not used> |
| 4 | <not used> |
| 5 | <not used> |
| 6 | <not used> |
| 7 | <not used> |
Command Format Details:
Byte 0 contains the command. Byte 1 is the AND term, byte 2 is the OR term. Byte 3 through byte 7 are unused.
Bits in the AND term that are 0 force the line to be a zero. The set bits act as a "don't care". Think of the 0 positions in the AND term as "turn off".
Bits in the OR term that are 1 force the output line high, the bits set to 0 are don't-cares. Think of the 1 positions in the OR term as "turn on".
Response Format:
| Byte Number | Description |
| 0 | 03h: WriteABitCmd |
| 1 | <not used> |
| 2 | <not used> |
| 3 | <not used> |
| 4 | <not used> |
| 5 | <not used> |
| 6 | <not used> |
| 7 | <not used> |
Response Format Details:
Byte 0 contains the command. Byte 1 through byte 7 are unused.
Example Usage:
Set every line in the port to output using the direction command. Set the entire port to 00h using the port write command.
Now set the lower nibble (lower 4 lines) high. The AND term can be FFh (all don't-cares), the OR term would then be 0Fh.
| Hardware: U401 USB Interface U421 USB Interface |
| Programming: USBm DLL Programming Download Files |
| Application Notes: U4x1 Application Notes Misc Applications and Information FAQ |