From Tim's website
Jump to: navigation, search
Line 1: Line 1:
  +
== [[Rugby Clock]] - Debug Information ==
  +
 
==== Is the oscillator running? ====
 
==== Is the oscillator running? ====
 
Check the signal on OSC2 (pin 10) - there should be a 4MHz sine wave.
 
Check the signal on OSC2 (pin 10) - there should be a 4MHz sine wave.

Revision as of 22:49, 25 April 2011

Rugby Clock - Debug Information

Is the oscillator running?

Check the signal on OSC2 (pin 10) - there should be a 4MHz sine wave.

If this isn't observed then check the PIC config word includes either the HS or XT type oscillators. The version available for download currently has a bug since it selects an R/C oscillator.

Is the program running?

Pull the input to pin 2 (AN0) high and low and checking the output of pin 26 (B5) - It should match the input.

If this isn't observed then check the LCD connections (see below) - The program waits indefinitely on a busy signal from the LCD at the start.

Does anything appear on the display?

If the screen is completely blank or just a series of black squares then check the contrast input to the LCD.

The message "Please Wait..." should appear at the start.

If this message isn't observed then check the LCD connections and view the control lines with an oscilloscope (see image).

LCD control signals
  1. The program starts with an initialisation sequence:
    1. 15ms delay
    2. RS low (select register 0)
    3. Repeat the following 3 times
      1. Set data
      2. EN low (clock data in)
      3. 200us delay
      4. EN high
      5. 5ms delay
  2. Send five commands followed by 14 characters (Image shows two characters)
    1. RS low
    2. RW high (read)
    3. Wait for D7 to go low
    4. RW low (write)
    5. Set data
    6. EN low (clock data in)
    7. 200us delay
    8. EN high
    9. Wait 5ms if a command was sent

I have created a small project to test the LCD display connection: ftp://ftp.timstyles.me.uk/www/lcd_test.zip

LCD test signals

In the test program the Read/Write line is kept low (so the R/W input to the LCD can be connected to ground for the test). The test starts with the RS line low (to send commands) and pulses the Enable line twice to clock two commands across the 8 data lines. The RS line is then taken high and 12 characters are clocked across the 8 data lines with 12 more pulses on the Enable line.

The program waits indefinitely after the 14 writes, so the watchdog timer resets the chip and the program ends up running about once every two seconds.

If you watch the LSB on the data port you should see the values shown in the trace on the right.

The C source and HEX files can be viewed here:

Does a counter increment on the display?

The message "Please Wait..." should appear at the start and the counter should increase once per second if the input to pin 2 (AN0) is receiving pulses from a radio receiver.

If the counter isn't incrementing then check the output of pin 26 (B5) is pulsing approximately once per second, which should follow the input to pin 2 (AN0).

Display counter increments but characters are garbled

There is no consistency checking on the input pulses, so if there are errors on the input then the displayed text will contain errors.

The error LED comes on

The error LED comes on when a pulse is received that doesn't match one of the expected patterns (see the Rugby Clock Circuit page). It will go out when a long pulse is received marking the start of a new minute. If you have a good MSF signal then the clock will function properly and the error LED will stay off. If there are errors in the signal then the display may show invalid or incorrect values and the error LED should come on.