Snap
- 30th June 2007, 07:13
Hello again, I am still working on my slot car timer and am very close to finishing it. However I am having a real problem when the cars cross the timing gantry at the same time. When a car tripps the light sensor it tells the pic to send a number to the pc to say I am in this lane and have passed another lap. The pic can do this so fast that it will actually reset and send another signal before the car has passed over the light. This registers more then one lap. I put in a pause of 1 sec after the signal has been sent and it works UNLESS another car trips it's sensor while the one second pause is timing. When two cars cross at more or less the same time one does not register. Is there any way to send a signal and wait a second or two but still send a different signal if it happens inside the pause. Im thinking there might be a way with interupts?
Any help would be appreciated. I will share the VB program when I am done.
Here is the code
Use the Pic 16f84 to controll the slot car track and
' Send the laps to the PC for timing and data storage
'
'
'
B0 var byte
'scale var byte
loop:
low portb.2
input 5
pot 3,49,B0
if (B0>45) then Car
if (b0<2)then Car
pot 4,49,B0
if (B0>45) then Car2
if (b0<2)then Car2
if portb.5 = 1 then reset
goto loop
Reset:
high portb.2
serout porta.2,0,[#100]
pause 2000
goto loop
Car:
high portb.2
serout porta.2,0,[#200]
pause 100
goto loop
Car2:
high portb.2
serout porta.2,0,[#300]
pause 100
goto loop
Thank You for you time ,Snap
Any help would be appreciated. I will share the VB program when I am done.
Here is the code
Use the Pic 16f84 to controll the slot car track and
' Send the laps to the PC for timing and data storage
'
'
'
B0 var byte
'scale var byte
loop:
low portb.2
input 5
pot 3,49,B0
if (B0>45) then Car
if (b0<2)then Car
pot 4,49,B0
if (B0>45) then Car2
if (b0<2)then Car2
if portb.5 = 1 then reset
goto loop
Reset:
high portb.2
serout porta.2,0,[#100]
pause 2000
goto loop
Car:
high portb.2
serout porta.2,0,[#200]
pause 100
goto loop
Car2:
high portb.2
serout porta.2,0,[#300]
pause 100
goto loop
Thank You for you time ,Snap