-
Project help
My final year project at university is designing and building a user interface for a plug in electronic timer that will switch on an external load at a set time and switch it off again at a set time.
I am using a 6808 processor and a 2x8 alphanumeric lcd display. I have 4 I/Ps, 2 of which are for a rotary encoder. I only know very basic C.
Would anyone be able to help with the program or provide some links to good example programs? Especially for a program which would run and display a real time clock on an lcd display? Thanks
-
Who designed the hardware?
1. Test the hardware, i.e., write a char to the LCD, etc, and you can read the rotary encoder wheels on the bus. Stuff the data in a variable, declaring it volatile is a tip, though its probably not neccessary.
2. Use the hardware manual for the Motorola 68xx processors. Read about timer registers. Then look in the manual for the C-compiler how to access the processors registers. Built a little Time structure, something like:
Code:
typedef struct Time {
unsigned char hours, minutes, seconds;
} Time;
Access it with:
Time time;
time.hours = value read from rotary wheel;
time.minutes = other value read from rotary wheel;
time.seconds = 0;
3. You then setup a timer register in the 6808 to generate an interrupt every second.
The interrupt shall trap a call to a Timer function that decrements time.seconds, etc.
Code:
--time.seconds;
if ( time.seconds > 59 ) {
time.seconds = 0;
--time.minutes;
if ( time.minutes > 59 ) {
time.minutes = 0;
--time.hours;
if ( time.hours > 23 )
time.hours = 0;
boom = true;
}
}
and then. . .
Code:
if ( boom )
SwitchRelay( ); /* etc. */
4. You need a simple interface Set Timer / Run / Stop.
And obviously a function to write to the LCD.
5. Some hardware buttons Run/Stop. Preset, etc.
Hope you get some ideas.