//KM 2018 03 23: getting lots of form spam; screen out dates before 2000 (book publication date) Source Files | Byte Craft Limited

Source Files

test1.c

This program exercises the relays. Compile and run it on the simulator, and you should hear one of the relays switching on and off.

test2.c

This program is a good test of the keypad library. It responds to keypresses by switching the relays.

atodtest.c

This file is the first test of the A/D converter. It illustrates the operation of the feedback loop. Note the extra statement needed to reset the input latch in the (disabled) IRQ circuit.

Run this program (from within an emulator, and from a chip) and scope both PORTB pin 5 and IRQ. Pictures of the respective waveforms appear below.

lcdtest.c

This is the first test of the LCD panel. We used a two-line, 20-character Optrex unit with the ubiquitous HD44780 controller. This just writes the alphabet to the controller repeatedly.

test3.c

A very important test program: use this to take readings to calibrate the temperature conversion routines as mentioned above. The program prints 'abc' to show the LCD is working, and then converts the ReadVoltage count into a hexadecimal representation.

test4.c

test4 helps calibrate the delay routines. The real work is within delay.c. This program toggles PORTB bit 5 (the A/D output) so you can scope it. Exchange the delay_100us(), delay_ms(), and elapse() functions, and check to see the length of the interval on an oscilloscope.

test7.c

This tests the use of the keypad and LCD panel at the same time. Since, in our design, the two are multiplexed, we needed to go through some trial and error before the keypad reading and lcd writing worked smoothly.

Remember that when running under the slower emulator, you will have to hold the keys down for a second to get the keystroke noted. Too quick a keypress at that speed will look like a bounce.

main1.c

This is the thermostat code.