First page Back Continue Last page Overview Graphics
Setting Bits using Logic Instructions
Example of using an OR to set a bit:
- LDAA PORTS
- ORAA #%00010000
- STAA PORTT
This code sets bit 4 of Port T. No other bits of Port T are affected. When setting a bit use a logical OR instruction and put a 1 in bit positions that you want to set.
This parallels the technique of using an AND with zeros in specific positions to clear bits. These techniques are extremely useful when several bits of a port are connected to hardware whose bits must be controlled individually.