Hi all
A little help if possible I searched the forum for any thing to do with air gun chronograph and found this post by JoePage2008x2,
http://www.picaxeforum.co.uk/showthread.php?t=12263&highlight=chronograph
In post 14 Womai suggested a circuit and gave a schematic, which I have used with a 40x2, connecting every thing as he describes and with my wonderful skills of programming have managed to see a result,
I have wired the sensor connections to two switches the first switch gives a result of 000us and the second 2047900us depending on how quickly I can press the switches,
My questions are is my code in the right field and am I reading all the outputs correctly into the picaxe if not can someone put me right please also what setfreq should I be using to slow things down so the switch readings make more sense my code is below,
I would like to get this all working before I attempt to work out how I will get it to display on an LCD, any help will be gratefully received thanks in anticipation
A little help if possible I searched the forum for any thing to do with air gun chronograph and found this post by JoePage2008x2,
http://www.picaxeforum.co.uk/showthread.php?t=12263&highlight=chronograph
In post 14 Womai suggested a circuit and gave a schematic, which I have used with a 40x2, connecting every thing as he describes and with my wonderful skills of programming have managed to see a result,
I have wired the sensor connections to two switches the first switch gives a result of 000us and the second 2047900us depending on how quickly I can press the switches,
My questions are is my code in the right field and am I reading all the outputs correctly into the picaxe if not can someone put me right please also what setfreq should I be using to slow things down so the switch readings make more sense my code is below,
I would like to get this all working before I attempt to work out how I will get it to display on an LCD, any help will be gratefully received thanks in anticipation
Code:
#picaxe 40x2
#terminal 9600
symbol pwmoutput = C.1
symbol Dff_Clr_n = C.0`pull low then high
symbol Ctr_Clr = C.2`pull high then low
symbol elapsedtime = w1
setfreq m8
Do
gosub configurepwmout
gosub configuredffclrn
gosub configurectrclr
gosub readinputs
gosub calculateanddisplayspeed
loop
configurepwmout:
pwmout C.1, 199, 400
return
configuredffclrn:
low c.0
pause 30
high c.0
pause 30
return
configurectrclr:
high c.2
pause 30
low c.2
pause 30
return
readinputs:
pulsin pinsD,1, elapsedtime
pulsin pinsB,1, elapsedtime
do
loop until pinD.0 = 1
return
calculateanddisplayspeed:
sertxd("elapsed time=",#elapsedtime,"00 us", CR,LF)
return