Developing Your Own - PbNation
Find fields & stores near you!
Find fields and stores
Zipcode
PbNation News
PbNation News
Community Focus
Community Focus

 
Archived Thread - Cannot Edit  
Old 11-07-2005, 01:24 PM #1
tyru
 
 
tyru's Avatar
 
Join Date: Dec 2003
Location: Maine
 has been a member for 10 years
Developing and Programming Your Own Electronics

SECTION I

Introduction:

Developing and programming a custom board for your marker is not for the faint of heart or cost effective. The money and time you spend to create your board will be far greater than buying a prebuilt board from many of the reputable after market board manufactures. You build custom electronics because you like doing it, you love and challange and you take pride in what you create.

If none of this scares you, than welcome to a thread which I hope will provide you with loads of tools and information to build your own custom electronics boards. Because we're in the PBNATION site, this will center around building a custom board to operate a electropneumatic marker.

I will continue to add to this thread on a regular basis (and as my time permits). Please add to the thread when you have a question or something to contribute. In other words, please do not let this thread stray off the subject.

Programming Tools:

MicroController Selection:

Although you can create a circuit to fire a marker using solid state electronics and gates, all electronic markers these days are operated by micro-controllers running a custom program.

Microchip is one of the largest producers of programmable "PIC" controllers and offers hundreds of different type in many pin counts and arrangments. Another popular choice are Atmel's AVR RISC processors. Atmel AVR

For this thread, I am going to start with a Microchip 16F648A-20 I/P chip. This is a 18 pin DIP chip with 16 potential I/O pins for marker functions including:

(the essentials)
trigger switch - digital input
ON/OFF button - digital input
Solenoid - digital output
(optionals)
Mode button - digital input
electronic eye - digital input or analog input (depending on type used)
communication - UART or ISP
LCD Display - serieal or parallel

In addition, the chip has plenty of memory, interrupts, EEPROM, WDT and a typical instruction set. This chip also has resources for online debugging, meaning that your can run the program directly on the chip and monitor registers. More about programming/debugging later on.

I choose DIP style chips during prototyping since they are inserted/removed easily using a ZIF (zero insertion force) socket. You will likely do this often during programming and prototyping to get things to work right. Once you get things working the way you want, you can consider switching to a smaller chip format, if needed.

Note also that I have chosen a flash programmablechip which will allow you to reprogram it thousands of times. Many of the commercial after market boards are created with write once read only controllers which will not allow you to reprogram them.

You can get chips from:

Mouser
Digi-Key
Hobby Engineering

$2-$4 a chip

Software:

The best part about using Microchip (TM) products is the free developement software (MPLAB IDE) that will allows you to write, simulate, program and debug using assembly language. There are also tons of subroutines online that can be used as a start or guidelines for developing your own programs.

MPLAB IDE

Once configured for your chip (16F648A), the software will take an assembly language program and convert it to Hex code instructions that the chip recognizes. You will then need a programmer to flash the Hex code into the memory on the chip.

In addition to assembly language, worth mentioning are also complilers for Basic and C programming. Basic and C are higher level languages that the compiler converts to equivalent hex code for the controller. There are several "free to try" compilers that can be used but typically a good compiler with no restrictions will cost you $200-$300 including:

PicBasic Pro
MikroBasic
Mbasic
CCS C Compiler

A couple of online PIC Programming tutorials are here:

MSTracey Pic Tutorial
Nigel's PIC Tutorial
Mark's PIC Tutorial

Both tutorials are worth a thorough reading and will give you a start to learning about assembly language programming. Note that they are both based on the 16F628 and 16F84, which are almost identical to the 16F648A.

Another good source of reading is Programming and Customizing PICmicro Controllers . This is a huge book which is a great resource but nothing you are going to feel like reading cover to cover.

Programmer:

There are lots of programmers out there. If your starting out, I would recommend one that is preassembled and tested complete with software which will allow you to program the chip. One of the better ones to use is a Microchip (TM) ICD2 programmer/in-circuit debugger.

ICD2 ICD

The ICD2 along with the PIC Start Plus programmer are recognized by MPLAB software which will simplify programming the chip. With the MPLAB IDE you can write your program code, "build" the hex code file, simulate the program running, flash the program to the PIC and then in-circuit debug, all using a single piece of software.

The ICD2 also has "In Circuit Serial Programming" ability. This is a method to connect the programmer to the chip which will allow you to program the chip while it is installed in the prototyping board.

I will be providing a walkthrough later of the ICD2 programming the 16F648A later on in this thread.

Several companies make ICD2 or PICstart Plus clones at about 1/2 the cost of the Microchip (TM) ICD2 or PICstart PLus:

Sparkfun carries the Olimex MCP and MCP-USB which are PICStart Plus compatible. They also carry the Olimex PIC-ICD2 that is compatible with the ICD2. While your there check out the the tutorials and support pages for good info and help.
Dontronics caries the KIT 150. This is a nice programmer with ISCP and a ZIF socket but will require separate software to program the chip. You can also check out the KIT 149 if your want serial port programming instead of USB programming.
Basic Micro's ISP-Pro is another programmer with lots of support but requires separate programming software. You can also get this nicely bundled in a package with thier basic compiler and prototyping board ISP PRO Package

The programmer I have been using is a ICD2 Clone by Micro4U. I have had very few problems with this board, however, you do have to connect pins on the universal ZIF socket depending on the chip you are using. (Note that these are shipped from Hong Kong and may take a while to get here)

Biuld Your Own ICD2 clone

Prototyping Board:

A prototyping board lets you set up an electrical circuit similar to your final application. In our case it will need to include a couple LED lights and micro switches to start with along with additional protoyping area for breakbeam eyes, communication port and possibly an LCD display. As we talked about before, an In Circuit Serial Programming connector would help during programming and testing phases.

There are hundreds of prototyping boards out there. I would recommend the one below or similar for this project.

DHMicro 18i or
Hobby Engineering

Again, if your just starting out, I would get the fully assembled board.

They also carry a very nice protyping board for 18 PIN chips Breadboard 18.

Section I Summary:

Lets summarize the programming tools you will need thus far:

16F648A-I/P Chip ($3)
MPLAB IDE (Free)
ICD2 Programmer ($50) or other
18i Prototyping Board ($25) or other

You should also have and electronics tool kit, multimeter and two 9-16 VDC wall adapters with center positive plug (you dont want to waste your 9V batteries) along 20-26 gauge wire and various other electronic components.

In Section II, I will be walking through the setup of the above tools and testing them with a simple program that will light an LED or sound the buzzer for a set period of time whenever you push a switch. (Starting to sound similar to something we all know and love to do).

We will also start to flowchart the operation required to get a marker to fire a paintball. I hope everyone will start giving input/feedback to the flowchart.

Last edited by tyru : 11-28-2005 at 04:00 PM.
tyru is offline  
Old Sponsored Links Remove Advertisement
Advertisement
Old 11-07-2005, 01:29 PM #2
Paint&Destroy21
BAAALLLSSS DEEEEP!!!!
 
Paint&Destroy21's Avatar
 
Join Date: Jan 2005
Location: sarasota, fl
Sticky maybe
Paint&Destroy21 is offline  
Old 11-07-2005, 01:46 PM #3
THOR4LIFE
Ka Mate, Ka Ora
 
THOR4LIFE's Avatar
 
Join Date: May 2005
Location: Portland/Eugene OR
GREAT!! I need a board made for my gun im making (without a board, the dwell is conroled by how long you hold down the trigger.....)
__________________
BMDT: We ARE better than you
We are correct
And we have a mod on our side...
Get over it
THOR4LIFE is offline  
Old 11-07-2005, 02:44 PM #4
midget patrol
DogFace
 
midget patrol's Avatar
 
Join Date: Nov 2003
Location: Northern VA
 has been a member for 10 years
Sticky!

This is a great resource. Thank you for starting with this. I'm sure i'll have some to add soon thanks to trial and error with building my own board.

Saving this space
__________________
AKA Owners Group
SKAforLIFE
Originally Posted by gremlin75
Just remember, working on AKA guns is a lot like butt sex. The more lube you use the easier things will slide in

Last edited by midget patrol : 11-08-2005 at 01:38 PM.
midget patrol is offline  
Old 11-07-2005, 06:45 PM #5
tyru
 
 
tyru's Avatar
 
Join Date: Dec 2003
Location: Maine
 has been a member for 10 years
Section II

Setting up the Software and Hardware:

The Prototype Board:

If you go to the second page of the 18i manual for the prototype board, you will see that this board has circuitry very similar to the circuitry required for a paintball marker.

9VDC is regulated to 5VDC for the controller (and possibly for a capacitor to drive a 5VDC solenoid. The board also includes two switches and two leds lights along with a micro buzzer. The microchip I/O pins are brought to a header in the prototyping area (area with a lot of holes. Switches and LED have pull up/pull down resistors so that they can be directly connected to the I/O pins of the microchip. A socket is provided for our 18 pin microchip.

This makes a great proto board but obviously not a board we can stick in a marker. Therefore, we will need to develop a PCB later with all the same circuitry (and more) but in a smaller package.

If you look at the left bottom part of the schematic you will see the I/O devices (switches, LEDs and Buzzer). You can check the buzzers and lights by connecting the corresponding pin the proto area to the +5 pins on the top or bottom row of the area.

470 Ohm Resistors (R5 and R6) are used to limit the curent through the LED, which would damage the microchip. Never connect a I/O pin to +5V without a resistor.

The buzzer (similar to a solenoid valve) takes a little more current than an LED and more than is safe for the microchip to drive directly. Thus, a transistor (Q1) is used. The transistor is an electronic switch. When the "BUZZ" pin is connected to +5V by the microchip, then the transistor allow current to flow through and activate that buzzer. This allows us to turn on a high power devices with the controller.

The LEDs and the Buzzer are activated using an output PIN on the microchip.

Note that the pins for the switches are also connected to +5V using a resistor. The state of the switch circuit is monitored by an Input pin on the microcontroller. When the input pin is connected to +5V, the pin is said to be "high" or ON and represented by a "1". The switch actually "pulls" the +5V circuit down to ground and the voltage goes "Low" at the input pin. This is represented by a "0". In this case, the logic of the circuit produces a "0" when the switch is pressed and a "1" when the switch is not pressed. Keep this in mind when programming.

The top right of the schematic shows the 16F648A controller chip with 18 pins. Although the chip has 16 I/O pins, two are used for an external timing circuit (OSC1 and OSC2) and one is dedicated to MCLR, which will Reset the chip. The I/O pins are marked RA0-RA4 (PORTA) and RB0-RB7 (PORTB).

This is how I would suggest intially setting up the board:
1) (RESET SWITCH) Connect SW2 to the MCLR pin. This will allow us to reset the chip.
2) (TRIGGER SWITCH) Connect SW1 to RA0.
3) (SOLENOID ON) Connect the Buzzer to RB1
4) (MODE) Connect LED1 to RA1
5) (SAFETY) Connect LED2 to RA2
6) (EYES) save RA3 for breakbeam eyes
7) (SAFETY SWITCH) save RB0 for safety/sleep mode on-off switch

Also save RB2 through RB7 for serial communication, ISCP and LCD interface.

Most of the I/O pins for the chip are bi-directional, meaning that we can define in the program whether the pin is going to be an input or an output. Some pins also have special additional functions such as comparitors for measuring analog inputs, communication, etc.

Chiumanfu submitted a wiring diagram for the board in the Ion: IOn Electrical Schematic by Chiumanfu and Ydna
The board uses a Atmel AVR chip but the schematic is similar to the prototype board.

Also check out this Thread onm Custom Boards:
http://www.pbnation.com/showthread.php?t=2158625&page=3

Test Program:

; By tyru
; 5/22/2007 Version 1.1

list p=16F648A
#include p16F648A.inc
;
; General purpose regs @ starting at 0x20 (Bank0)
;
cblock 0x20
DEL1 ; 0x20 (number of microseconds)
DEL2 ; 0x21
endc
;
; RESET Vector
;
ORG 0x000 ; origin
clrf PCLATH
goto Main
;
; Main Program Starts HERE
;
Main
clrf PORTB ; clear the ports
clrf PORTA
bsf STATUS,RP0 ; go to Bank 1
movlw 0x0
movwf TRISA ; All PortA Pins to Outputs
movlw b'00000011'
movwf TRISB ; RB1 to an input pin
bcf STATUS,RP0 ; go back to Bank 0

;---Check if Switch is Pressed
SWITCH1
btfsc PORTB,1 ; check the switch on RB1
goto SWITCH1 ; goto SWITCH1 if pin is not pressed (high)
movlw 0x10 ; Load w with 10 milliseconds
call WAIT ; call delay to debounce the switch
btfsc PORTB,1 ; check the switch on RB1 again
goto SWITCH1 ; goto SWITCH1 if pin is not pressed


;---Fire the Marker Routine
movlw 0x1
movwf PORTA ; turn RA0 on
movlw 0x30 ; Load w with 30 milliseconds
call WAIT ; call delay
movlw 0x0
movwf PORTA ; turn RA0 off

;---Check if Switch is Released
SWITCH2
btfss PORTB,1 ; check the switch on RB1
goto SWITCH2 ; goto SWITCH2 if pressed
movlw 0x10 ; Load w with 10 milliseconds
call WAIT ; call delay to debounce the switch
btfss PORTB,1 ; check the switch on RB1
goto SWITCH2 ; goto SWITCH2 if pressed

goto SWITCH1 ; go back to switch1

;************************************************* ****************
; WAIT (1mS delay subroutine)
;
; This subroutine takes the value in W and multiplies it
; times 1 millisecond to determine total delay time.
;
; Requires: DEL1 & DEL2 registers defined.
;
; Note: Timing in this subroutine makes the assumption that
; the PIC is running with a 4MHz XTAL or external clock.
; Timing will obviously be different for different clock
; speeds.
;
; Executed by:
; MOVLW 0x?? ; duration of delay in mS
; CALL WAIT
;
;************************************************* ****************

WAIT
MOVWF DEL1
MOVF DEL1,F
BTFSC STATUS,Z ; check for zero
RETURN ; if DEL1 = zero just return
DLOOP1
MOVLW 0x64 ; 64 initialize inner loop
MOVWF DEL2
DLOOP2 NOP
NOP
NOP
NOP
NOP
NOP
NOP
DECFSZ DEL2,F ; inner loop complete?
GOTO DLOOP2 ; no? go again
DECFSZ DEL1,F ; outer loop complete?
GOTO DLOOP1 ; no? go again
RETURN

END

Marker Flow Chart:

Last edited by tyru : 05-22-2007 at 11:02 AM.
tyru is offline  
Old 11-07-2005, 09:28 PM #6
spngebob619
Awaiting Email Confirmation
 
spngebob619's Avatar
 
Join Date: Jun 2005
Location: Ft. Wayne, IN
spngebob619 is a Supporting Member
the three above should delte there posts
__________________
FEEDBACK (i got banned but its me imaginer123)

STERLING GREAT CONDITION F/S/T

"Originally posted by spydersplatter: My trix was born from the mating of satan and a john deere 345 power steering lawn mower. it will mow down anything in it's path leaving nothing but fire and brimstone in it's wake."
spngebob619 is offline  
Old 11-08-2005, 11:27 AM #7
tyru
 
 
tyru's Avatar
 
Join Date: Dec 2003
Location: Maine
 has been a member for 10 years
Saving this Space for Section III

These are just proposed topics. Note that it is not my intent to write a program for you. There are many different ways and styles to program these sequences/routines. Some will probably work better than others. Some may not work at all. The intent is to provide tools for developing your own customized program and for everyone to provide information/comments/questions/issues/feedback/etc back to this thread.

Main Sequence:

Trigger Debounce Subroutine:

Fire Sequence Subroutine:

Safety/Sleep Modes:


Section IV

Break/Bounce Beam Eyes - Ball Detection:

WDT:

Firing Modes:


Section V

EEPROM

Setting Parameters

LCD

Section VI

Electrical Principles:

Warpig Basic Electronics Tutorial
DC Electric Circuits Lesson

Wiring Schematics:

Chiumanfu submitted a wiring diagram for the board in the Ion: IOn Electrical Schematic by Chiumanfu and Ydna

PCB Development:

Other Stuff:

Last edited by tyru : 11-15-2005 at 11:11 AM.
tyru is offline  
Old 11-08-2005, 01:07 PM #8
moppedclean
Fear the Rat
 
moppedclean's Avatar
 
Join Date: Sep 2002
Location: Minnesota
 has been a member for 10 years
Here is about the simplest example you will find. It's nothing fancy, but it should help you get started. I know when I first started building boards, I would have liked to see an example, so I hope it helps.

This is a project I had going for my spyder imagine using the PIC12F675.
Notes on the board: The board uses a sliding switch to turn power on/off to the board by just disconnecting the battery. If you learn how to use interrupts in your program then you can go about it different, but I found interrupts to be one of the hardest things to learn. The board has two inputs- the eye status, and the trigger status. A high logic from the eye output will correspond with the eyes being blocked(ball present). The trigger when pushed will correspond to a low logic. And the one output is the solenoid which is activated by a high logic from the micro. There is no adjustability in this program so the dwell and debounce are set to 10ms. If you wanted to use this schematic and program on a sear-tripping gun, you would have to change the schematic so that there is +9V(battery voltage) on the other side of the solenoid instead of +5V. Also, you would have to change the dwell in the program to around 6ms.
I am planning on starting up my Imagine project again, so I will add more and more features to the program in the future.
program--
http://home.comcast.net/~millersseven/ImaginE.asm
schematic--
http://home.comcast.net/~millersseven/sample.JPG
__________________
Rat Impulse ECS'd
Tribal BBT
Spyder Imagine

Last edited by moppedclean : 11-09-2005 at 02:29 PM.
moppedclean is offline  
Old 11-08-2005, 03:06 PM #9
tyru
 
 
tyru's Avatar
 
Join Date: Dec 2003
Location: Maine
 has been a member for 10 years
Thanks for responding and I'm glad your all going to be providing some input. I am trying to hold some sections for particular codes and schematics that are tested and functional. Full credit will go to the author.

Note to Moderator: If possible, move any parts marked SECTION to the beginning of the thread. I will probably end up making a section for each part of the program/schematic and other topics.

Some general guidlines on submissions:

If you provide code, please make sure in contains annotations. This should include a labeled section with a version number, who wrote it or source of the code, circuit requirments and date along with a short description of the routine and programming requirments such as defined parameters, needed memory adresses, fuses, configuration bits, etc.

If you submit code you created on this thread, the code will be considered public and can be used by anyone. Do not submit patented or copywrited programming.

Try to also annotate the code step by step so that it is easy to follow.

For those just starting out with some input to offer, try your best.

If you find an error in some code or a schematic submitted on this thread, send a PM to the author so that they can make a correction. Please Do Not Flame People.

If you modify the Authors code to make it work better or differently, make sure you give the original author some credit and describe your modifications.

Break up your code and schematics for performing specific tasks. For example, provide a schematic for the trigger switch connected to an I/O port along with a subroutine for debouncing the trigger. Try not to provide code for a entire operation of the marker. I'm hoping to have a section with a bunch of debounce routines. Eye schematic and routines. etc.

Codes and schematics that are tested and functional, I will reference in the Sections at the beginning of this thread.

Last edited by tyru : 11-08-2005 at 09:15 PM.
tyru is offline  
Old 11-10-2005, 09:36 PM #10
originalspyderxtra
God I Wish I Was Snoopy
 
originalspyderxtra's Avatar
 
Join Date: Mar 2005
Location: staten island NY
^^^^ i have always wanted to do this but i dont have a lot of cash. i hear some new christmas present ideas. and yes someone sticky this. it will be ever so helpful.
__________________
1979 T/A 6.6
1990 Chevy Suburban 1500 4x4
My Feedback 19 Positive
New Feedback 1 Positive
Cocker part out and more

Last edited by originalspyderxtra : 11-10-2005 at 10:09 PM.
originalspyderxtra is offline  
Old 11-10-2005, 10:13 PM #11
x2800m
 
 
Join Date: Sep 2005
technically you don't even need any interrupts. My program uses the BTFSS command for the eyes and the trigger. the gun runs a loop and checks the trigger. if the trigger is set then it goes to the fire subroutine. then it does another btfss for the eyes. if the eyes are blocked it fires the solenoid.
x2800m is offline  
Old 11-11-2005, 11:55 AM #12
Ydna
timetraveler
 
Ydna's Avatar
 
Join Date: Oct 2003
Location: Tecumseh MI
Ydna is a Moderator
Ydna is a Supporting Member
 has been a member for 10 years
Ydna is BST Trusted
Quote:
Originally Posted by moppedclean
Here is about the simplest example you will find. It's nothing fancy, but it should help you get started. I know when I first started building boards, I would have liked to see an example, so I hope it helps.
.....
hmmmm interesting to see you working the marker at only 5v to the solenoid. Have you tried it at a straight 9v from the battery? Response may be noticeably more quick.
__________________
ydna@zdspb.com - [ZDSPB.com]
Nummech Products
Thin Air Sports

As told by Stobaeus
...someone who had begun to learn geometry with Euclid, when he had learnt the first theorem, asked Euclid "What shall I get by learning these things?" Euclid called his slave and said "Give him threepence since he must make gain out of what he learns".
Ydna is offline  
Old 11-11-2005, 12:28 PM #13
moppedclean
Fear the Rat
 
moppedclean's Avatar
 
Join Date: Sep 2002
Location: Minnesota
 has been a member for 10 years
x2800- Yeah, I don't think anyone would really need to use interrupts with the trigger or eye system. However interrupts would come in very handy for using a power button and for the auto turn off feature.

Ydna- All electro-pneumatic solenoids I have seen are rated for 5V. However, those solenoids will work fine with 9V going to them. I have a Morlock board in my Tribal right now that uses 9V on the solenoid and it seems to work fine. But like I said, if you are running a solenoid for a sear-tripping gun, you will need the full battery voltage to run it.
__________________
Rat Impulse ECS'd
Tribal BBT
Spyder Imagine
moppedclean is offline  
Old 11-11-2005, 12:37 PM #14
Ydna
timetraveler
 
Ydna's Avatar
 
Join Date: Oct 2003
Location: Tecumseh MI
Ydna is a Moderator
Ydna is a Supporting Member
 has been a member for 10 years
Ydna is BST Trusted
The solendois are available in a variety of voltage ratings, however from what I've seen most companies tend to use the 5v or 7v varieties. But don't even think there aren many stock boards that follow the ratings. SP boards, for instance, go 7-v for their 5-v Parker solenoids. The newer Humphrey solenoids (CRCB series, used in other guns) is rated at 7v. But like you said, anyone can throw 9-v into them using a Morlock, Tadao, or whatever other boards and work okay.

But if you use a reg and drop it, you'd have to pick one with a lot of current (I suspect) since those coils can draw a lot on their own.

Anyways, I use straight 9v on my boards. Just throught I'd mention that since this threads should cover it all.
__________________
ydna@zdspb.com - [ZDSPB.com]
Nummech Products
Thin Air Sports

As told by Stobaeus
...someone who had begun to learn geometry with Euclid, when he had learnt the first theorem, asked Euclid "What shall I get by learning these things?" Euclid called his slave and said "Give him threepence since he must make gain out of what he learns".
Ydna is offline  
Old 11-11-2005, 02:05 PM #15
tyru
 
 
tyru's Avatar
 
Join Date: Dec 2003
Location: Maine
 has been a member for 10 years
The solenoid would probably be driven using a transistor at battery voltage (9V) in order to keep the size of the board down and avoid a large power regulator with a heatsink.

Don't forget a capacitor may also required. Solenoids typically have inrush currents which could cause the power at the regulator to drop to the point of causing a "brownout" at the controller chip. The capacitor acts just like a battery, but with much less storage capacity. It provides an extra boost during activation of the solenoid to meet inrush current and stabilize power to the rest of the control circuit. The larger the inrush current of the solenoid, the larger the capacitor required. This is why sear trippers have a huge capacitor in order to stabilize power to a solenoid that must do more mechanical work (pull the sear) compared a pnuematic solenoid (position a 3-4-5 way valve).

At this point, I would agree that the trigger does not need to be on an interrupt pin. If you noticed I put the ON/OFF switch on RB0 (for now), which is typically configured as an interupt I/O.

Note that if you are just creating a board that will do Semi only, then looking for a trigger pull, debouncing and then firing would be good. But what if you want a few more modes such as full auto, ramping, fire on the pull and release, etc. Then you would need to look for a change in state of the trigger pin and set bits corresponding to four trigger conditions:

Say you hold the last state of the trigger switch in a bit called LAST and read the current state of the switch into a bit called NEW.

If LAST="1" and NEW="1" (remember that "1" = trigger not pulled) then the trigger is NOT PULLED (do nothing)
If LAST="1" and NEW="0" then trigger if JUST PULLED (call your FIRE subroutine)
If LAST="0" and NEW="0" then the trigger is HELD (call your FULL AUTO subroutine)
If LAST="0" and NEW="1" the the trigger was JUST RELEASED (call your FIRE routine if responce mode is on)

I would probably have a register that stores these four conditions as four of the bits of the register along with a "FIRE enable bit" connected to a timer sequence to cap the firing rate.

These are just some very initial programming thoughts. What d you think?
__________________
SP ION, ND Trigger, QEV, AGM Black/Blue Shell, Killa Detents, SP On/Off, Evil Barrel

Last edited by tyru : 11-15-2005 at 11:18 AM.
tyru is offline  
Old 11-11-2005, 06:48 PM #16
Ydna
timetraveler
 
Ydna's Avatar
 
Join Date: Oct 2003
Location: Tecumseh MI
Ydna is a Moderator
Ydna is a Supporting Member
 has been a member for 10 years
Ydna is BST Trusted
In terms of simplicity I'd agree with your method there. it's basically what I'm doing with the board I programmed. However I suspect (without thinking about it) things may need to become a little more complex once the user starts adding other timer-based variables. But I'm not concerned with that at this point...

About the voltage regs, generally you'll need around 300mA at least to be supplied to the pilot-based solenoid (Parker, humphrey, SMC, probably not MAC though). Sear-tripper solenoids woudl need more or a big ole cap like he mentioned above. Pilot-based solenoid boards usually carry any number of smaller capacitors, nobody goes larger than 10-F though.
__________________
ydna@zdspb.com - [ZDSPB.com]
Nummech Products
Thin Air Sports

As told by Stobaeus
...someone who had begun to learn geometry with Euclid, when he had learnt the first theorem, asked Euclid "What shall I get by learning these things?" Euclid called his slave and said "Give him threepence since he must make gain out of what he learns".
Ydna is offline  
Old 11-11-2005, 11:04 PM #17
imp pimp 101
Weekend Warrior
 
imp pimp 101's Avatar
 
Join Date: May 2005
Location: New Mexico
anyone know where to get open source impulse code? i remember it being on sourceforge a while ago but search is down on the site.
__________________
Proto Players

Forums for NM paintballers are back!

SP arent nazis, their just misunderstood!
imp pimp 101 is offline  
Old 11-15-2005, 10:53 AM #18
tyru
 
 
tyru's Avatar
 
Join Date: Dec 2003
Location: Maine
 has been a member for 10 years
I've created a small test program which I'll post above in SECTION II. I'm also setting up a FTP/Web Page site for code instead of taking up room on this tread.

In looking at debounce routines, I'm looking for opnions:

Option 1: On a change in the state of the trigger switch, wait a delay period (debounce delay), then recheck the switch position. If the state of the switch is still changed, then do the action.

Option 2: On the change in state of the trigger switch, continuously check the state of the switch in a loop. If the state of the trigger switch remains changed for a certain number of cycles (debounce period), then do the Action.

Option 3: ?

The first option is simpler but may be a little more wastefull of clock cycles.

The second option is a little more complicated but allows the main program to continue to operate while you wait for the switch to achieve a final state. The program may go in and out of the debounce several times before the switch becomes debounced, which may cause some variance in debounce periods.
__________________
SP ION, ND Trigger, QEV, AGM Black/Blue Shell, Killa Detents, SP On/Off, Evil Barrel

Last edited by tyru : 11-15-2005 at 10:58 AM.
tyru is offline  
Old 11-15-2005, 01:29 PM #19
Ydna
timetraveler
 
Ydna's Avatar
 
Join Date: Oct 2003
Location: Tecumseh MI
Ydna is a Moderator
Ydna is a Supporting Member
 has been a member for 10 years
Ydna is BST Trusted
I believe, theoretically, option 2 would be the better way to go. However for starters it might not need to be that complex (as you mentioned). If I had to choose I'd go with the second though.

I will try to put both together later today and see how it goes.

Anyways...website would be a great idea. Posting all the information on this thread would only be so useful in terms of organization (especially since there's a character limit...)
__________________
ydna@zdspb.com - [ZDSPB.com]
Nummech Products
Thin Air Sports

As told by Stobaeus
...someone who had begun to learn geometry with Euclid, when he had learnt the first theorem, asked Euclid "What shall I get by learning these things?" Euclid called his slave and said "Give him threepence since he must make gain out of what he learns".
Ydna is offline  
Old 11-18-2005, 12:10 AM #20
Chiumanfu
 
 
Chiumanfu's Avatar
 
Join Date: May 2005
Location: Vancouver Canada
You'll find interrupts to be more difficult initially but a whole lot more powerful at the end when you have mulitple timers running and a long main loop.

[main]
Enable interrupt and set vector
If trigger_accumulator <> 0 then {
Call fire_cycle_subroutine
Decrement trigger_accumulator
}
Else Jump [main]

[trigger interrupt vector]
If timer1 > debounce_setting {
Increment trigger_accumulator
Reset timer1
Return
}
Else Return
__________________
PbN FB
.`..hmn..`.

Last edited by Chiumanfu : 11-21-2005 at 02:02 PM.
Chiumanfu is offline  
Old 11-18-2005, 04:48 PM #21
animalaapthy
Thats Right, <3
 
animalaapthy's Avatar
 
Join Date: Jan 2004
Location: Mass 01982 ~ECC~
 has been a member for 10 years
Question

If you are programming an 18 pin chip, could you not use that chip in any existing board already available for your marker that takes chips.
For example if someone owns a DM4 could they use one of thier self programmed chips in their DM4 board?
__________________
I WALK AROUND METAL DETECTORS.
^^and there ain't **** you can do about it^^

MYFEEDBACK!
animalaapthy is offline  
 




Posting Rules
Forum Jump