A 68HC12 is being used to communicate with two devices over the SPI.
The devices are connected as shown below:
Each byte you write to the LCD chip is displayed on an LCD display. The
following shows how to write to the LCD chip over the SPI:
The GP2D device is a distance sensor.
When the HC12 reads from the GP2D chip, the GP2D sends it a byte which tells
it how far it is from an object (such as a wall). The GP2D sends a 0x00 when
it is almost touching the object. It sends a 0xFF when it is 2 feet (or more)
from the object. The following shows how to read from the GP2D chip over the
- How do you set up the HC12 to communicate with the LCD and the GP2D?
Explain what values you need to write to which registers. Be sure to set the
correct clock phase and polarity. Also, set up Port P so that both the GP2D
and the LCD are deselected.
- Write some C code to set up the HC12 to communicate with the LCD chip
and the GP2D chip - i.e., write C code to implement (1).
- Write some C code to read the distance from the GP2D. Make sure the LCD
chip is deselected while you are doing this.
- Write some C code to sent the sequence "Hello" to the LCD chip. Make
sure the GP2D is deselected while you are doing this.