Motor Port

Address: $1004 (Port B)
Initialization: None
Format:
E4
E3 E2 E1 D4 D3 D2 D1

Input Operations: Old contents are available, so logical operations are possible.
Output Operations: Writing data to register causes motor operation. E is motor enable bits, D is motor direction bits.

Thus we can store a value to the Port B address, and that causes output values to change. Since we use port B as output only, what does it mean to load a value from this address? Nothing really; it is just the value last loaded to the port. Sometimes we can use it to turn particular motors on or off without effecting the state of other motors.

On our circuit board, we use port B to control up to four motors, in forward, reverse or off. The upper four bits of port B are on/off bits for each motor, and the lower four bits are direction bits.