robadobalus
New Member
Hello,
For an A2 electronics project I am making an LED clock with the use of PIC's.
To start with I have one pic generating a steady accurate 1hz pulse. This clocks into shift registers for 60 seconds before resetting. I plan to take the 60th pulse and use that as a minute pulse for the next sub system. I plan to use PIC 16F882/883/886 in a dot matrix configuration to give me x64 combinations and then use the 60th output to reset the count and be the hourly clock for my final sub system; which will include a 16F84A.
I am planning to use the Timer0 module inside the pic's to count the number of pulses on a specific pin and then with this information stored I can write the rest of the program.
At the moment I have written the hour program but it does not seem to be working properly. I have read through the data sheet and have done what I think should work...
As I am new to PIC Basic programming am writing the program as simple as possible so that I can see what I am doing. At the moment its just the program that is holding me back, as I have completed all the hardware and everything else, so If anyone can see what I have got wrong in the program any advice would be appreciated. I am not 100% sure on how to use the timer0 module and all my googling seems to have come up with stuff with isnt basic enough for my level or just not explain how to write the program for the timer module.
Thanks,
Rob
P.s. the program is added below.
Device = 16F84
XTAL = 4
Start:
OPTION_REG = %10111000
TRISA = %10000
TRISB = %00000000
PORTB = 0
PRTA = 0
Dim Timing As Byte 'Declare Timing as value 0 to 255
Timing = TMR0 'Vairable timing should be data from the Timer
Timer:
If Timing = 0 Then PORTB.0 = 1
If Timing = 1 Then PORTB.1 = 1
If Timing = 2 Then PORTB.2 = 1
If Timing = 3 Then PORTB.3 = 1
If Timing = 4 Then PORTB.4 = 1
If Timing = 5 Then PORTB.5 = 1
If Timing = 6 Then PORTB.6 = 1
If Timing = 7 Then PORTB.7 = 1
If Timing = 8 Then PORTA.0 = 1
If Timing = 9 Then PORTA.1 = 1
If Timing = 10 Then PORTA.2 = 1
If Timing = 11 Then PORTA.3 = 1
If Timing = 12 Then TMR0 = 0
GoTo Timer
For an A2 electronics project I am making an LED clock with the use of PIC's.
To start with I have one pic generating a steady accurate 1hz pulse. This clocks into shift registers for 60 seconds before resetting. I plan to take the 60th pulse and use that as a minute pulse for the next sub system. I plan to use PIC 16F882/883/886 in a dot matrix configuration to give me x64 combinations and then use the 60th output to reset the count and be the hourly clock for my final sub system; which will include a 16F84A.
I am planning to use the Timer0 module inside the pic's to count the number of pulses on a specific pin and then with this information stored I can write the rest of the program.
At the moment I have written the hour program but it does not seem to be working properly. I have read through the data sheet and have done what I think should work...
As I am new to PIC Basic programming am writing the program as simple as possible so that I can see what I am doing. At the moment its just the program that is holding me back, as I have completed all the hardware and everything else, so If anyone can see what I have got wrong in the program any advice would be appreciated. I am not 100% sure on how to use the timer0 module and all my googling seems to have come up with stuff with isnt basic enough for my level or just not explain how to write the program for the timer module.
Thanks,
Rob
P.s. the program is added below.
Device = 16F84
XTAL = 4
Start:
OPTION_REG = %10111000
TRISA = %10000
TRISB = %00000000
PORTB = 0
PRTA = 0
Dim Timing As Byte 'Declare Timing as value 0 to 255
Timing = TMR0 'Vairable timing should be data from the Timer
Timer:
If Timing = 0 Then PORTB.0 = 1
If Timing = 1 Then PORTB.1 = 1
If Timing = 2 Then PORTB.2 = 1
If Timing = 3 Then PORTB.3 = 1
If Timing = 4 Then PORTB.4 = 1
If Timing = 5 Then PORTB.5 = 1
If Timing = 6 Then PORTB.6 = 1
If Timing = 7 Then PORTB.7 = 1
If Timing = 8 Then PORTA.0 = 1
If Timing = 9 Then PORTA.1 = 1
If Timing = 10 Then PORTA.2 = 1
If Timing = 11 Then PORTA.3 = 1
If Timing = 12 Then TMR0 = 0
GoTo Timer