SSE8680 examples

Real-Time-Clock and Temperature

The first example is real-time-clock and temperature.  This example uses several pre-build routines, and call each routine in sequence.  Those subroutines include time delay, LCD display and temperature reading routines.

You can download this RTCnTMP.HEX file, and program SSE8680 evaluation board with this HEX file via ICD2.  When the HEX is programmed, disconnect ICD2 cable from SSE8680.  The LCD display will show current time.  If you press push button S7, the LCD will show current temperature.

2x20 Character LCD Display

The pin connection is listed on SSE8680 page.  In order to use on-board LCD display, some steps need to be done prior to send character to LCD display. 

To initialize the LCD:

  1. Set PORTH as digital IO: Move 0x0F to ADCON1.
  2. Enable PORTH output:  Clear TRISH.
  3. Set 8-bit interface, 2 rows and 5x7 dots: Move 0x38 to PORTE
  4. Toggle E-pin: H/L.

To send the commands to LCD:

  1.  Clear display.
  2.  Set cursor home.
  3. Set entry mode.
  4. Set display mode.
  5. set Character generator RAM address.
  6. Toggle E-pin.

To send the character to LCD:

  1. Send characters to PORTE.
  2. Toggle E-pin.

LCD commands:

Command

HEX Code Execution Time
Clear Display, Cursor to Home 0x01 1.64 ms
Cursor to Home 0x02 1.64ms
Cursor decrement, Shift Off 0x04 40us
Cursor decrement, Shift On 0x05 40us
Cursor Increment, Shift Off 0x06 40us
Cursor Increment, Shift On 0x07 40us
Display, Cursor, and Cursor Blink Off 0x08 40us
Display On, Cursor and Cursor Blink Off 0x0C 40us
Display and Cursor On, Cursor Blink Off 0x0E 40us
Display, Cursor, and Cursor Blink On 0x0F 40us
Cursor Shift Left 0x10 40us
Cursor Shift Right 0x14 40us
Display Shift Left 0x18 40us
Display shift Right 0x1C 40us
2x20 Size 0x3C 40us

Character Codes:

Download LCD8680 ZIP file

TC72 Temperature Sensor

Tc72 is a SPI compatible temperature sensor.  The pin connection is listed on SSE8680 page.  The functions of this example are control register modifying , temperature reading and manufacture ID reading.  When the power is applied to SSE8680, control register needs to need set to conversion mode prior to read the data.

TC72 registers:

Register Read address Write Address Value on POR/BOR
Control 0x00 0x80 0x05
LSB Temperature 0x01 N/A 0x00
MSB Temperature 0x02 N/A 0x00
Manufacture ID 0x03 N/A 0x54

Download TC728680 ZIP file

Analog-toDigital Converter

PIC18F8680 provides 16 10-bit resolution analog to digital converter channels.  This program demonstrate how to set up ADC registers and display the result on LEDs.  The LEDs are connected PORTD, and analog signal is connected RA0.  A 5 Kohm potentiometer provides voltage from 0v to Vcc, and the reference voltage is connected Vcc and ground.  The following steps lead you to set up the ADC registers.

  1. Modify ADCON0 register: select channel 0, A/D idle, ADON. Move 0x01 to ADCON0
  2. Modify ADCON1 register: configure reference voltage, and AD port. Move 0x0E to ADCON1.
  3. Modify ADCON2 register: configure result format, acquisition time, and AD conversion clock. Move 0x92 to ADCON2.
  4. Clear ADIF bit, or enable interrupt.
  5. Set GO/DONE bit.
  6. Wait for conversion to complete or AD interrupt.
  7. Read the result: ADRESH:ADRESL

Download ADC8680 ZIP file

¡@

¡@

¡@

¡@

¡@