Hi all.
I have been working on a propeller clock for a few months now and I'am almost there.
The problem now is that as the speed of the motor varies so does the spacing of the display, too slow and there is a gap at the end of the display, too fast and the display isn't complete.
Each rotation of the display triggers an input on pin c.2 using a Hall effect switch. I have tried using PULSIN on the Hall effect to time each rotation and space the display in proportion but this doesn't work as I need the Hall switch to register the start position for the display also.
Using SETINT worked as a trigger but again wouldn't work with PULSIN.
I think the key lies in getting the Hall switch to work as a trigger to start the display and as an input to the PULSIN.
Any help or suggestions would be greatly appreciated, thanks.
I have been working on a propeller clock for a few months now and I'am almost there.
The problem now is that as the speed of the motor varies so does the spacing of the display, too slow and there is a gap at the end of the display, too fast and the display isn't complete.
Each rotation of the display triggers an input on pin c.2 using a Hall effect switch. I have tried using PULSIN on the Hall effect to time each rotation and space the display in proportion but this doesn't work as I need the Hall switch to register the start position for the display also.
Using SETINT worked as a trigger but again wouldn't work with PULSIN.
I think the key lies in getting the Hall switch to work as a trigger to start the display and as an input to the PULSIN.
Any help or suggestions would be greatly appreciated, thanks.
Code:
main:
#picaxe 40X2
#no_data
#no_table
setfreq em16 ' This line sets th clock speed to 16 MHz.
' A 16MHz resonator needs to be connected to pins 13 & 14.
let dirsA = %11111111 ' Set port A as all outputs.
let dirsB = %11111111 ' Set port B as all outputs.
let dirsC = %11111011
let dirsD = %11111111 ' Set port D as all outputs.
SYMBOL wandspeed = w25
SYMBOL segmentgap = w26
low C.1 'Blue when high.
high C.5 'Red when high.
' Turn ports B & D off
let outpinsA =%11111111
let outpinsD =%11111111
let outpinsB =%11111111
high C.1 'Blue when high.
low C.5 'Red when high.
start:
pulsin c.2,0,wandspeed
segmentgap = wandspeed / 20
let outpinsA = %00000000
pause segmentgap
let outpinsA = %11111111
pause 30
let outpinsA = %00000000
pause segmentgap
let outpinsA = %11111111
goto start
Attachments
-
86.9 KB Views: 30