Ò.K. after few Paintbal Gun user and gamers talkin. I learn a few things on a common gun DM4. I'll assume these i heard
1. Human can shoot about 20 balls/seconds
2. Full automatic : about 13 balls/seconds
let's figure your gun,loader and everything i don't know, can do this. i'll figure more time for loader time than solenoid time.
let's figure it a the maximum of 20 balls/seconds. we will use 20Hz as frequency with an 40% duty cycle (i figure high level as time on gun solenoid). So about 20ms for solenoid time, 30ms for loader time. i'll use an PIC12F675
Code:
ANSEL=0
CMCON=7
TRISIO=1 ; GPIO.0 as input, other as output
GunDetent VAR GPIO.0 ;GP0 as detent input
Solenoid VAR GPIO.1 ;GP1 as Solenoid output
KillEmAll VAR BYTE
Loop VAR BYTE
T_ON VAR BYTE
T_OFF VAR BYTE
IsItTimeFiring VAR BYTE
KillEmAll=3
T_ON=20
T_OFF=30
IsItTimeFiring=0
Solenoid=0
start:
While GunDetent=0 ;wait for detent press
Wend
If IsItTimeFiring !=8 then
Gosub ActivateSolenoid
IsItTimeFiring=IsItTimeFiring+1
ELSE
FOR Loop=0 to KillEmAll
Gosub ActivateSolenoid
NEXT
IsItTimeFiring=0
ENDIF
WHILE GunDetent ;wait for detent release
WEND
GOTO start
ActivateSolenoid:
Solenoid=1
PAUSE T_ON
Solenoid=0
PAUSE T_OFF
RETURN
this should work as you want.
Last edited by mister_e; - 28th October 2004 at 01:24.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks