First page Back Continue Last page Overview Graphics
Laboratory 2.2 (cont)
Write a program to read the switches at port T (address $ae) from the evaluation board, add 3 to the value read from the switches, and write the resulting value to the board's LEDs. The LEDs can be accessed via port S (address $d6).
- To make port S an output port, add code to your program that writes $ff to memory address $d7.
- Read value for port T to register A
- Add 3 to register A
- Write the value in register A to port S.
The I/O ports on the 68HC12 are bidirectional. By default the bidirectional ports are inputs. A data direction register that programs the direction is associated with each register. To make a bit an output, write a 1 to the corresponding bit in the data direction register. As an example to make bit 2 an output bit, write a $04 to the port’s data direction register.