0 1 2 3 4 5 6 7 8 +5V A A +5V 1 RA1 10kOhm B 2 3 4 5 6 7 8 9 B C D J2 6P4C (RJ11) To PC R5 470ohm U2 4N33 X1 RESONATOR 4 MHz U1 14 Vdd 5 Vss 4 RB7 MCLR/ RB6 RB5 RB4 6 INT/RB0 RB2 16 RB1 OSC1 15 OSC2 PIC16F84_1 13 12 11 10 8 7 R1 6.8kohm reserved pulse width stim freq int/ext trig V (+) Jumper block J3 HDR2X4 +5V R4 330ohm LED1 C D E R2 0% 10kOhm Key = a Amplitude D1 IN4004 white T1 red 3 2 1 J1 E F R3 6.8kohm white yellow 6.3 VCT 1/8" PHONE PLUG F IRL520N Q1 Electrodes G V (+) U3 LM78L05 G H To battery 9-18 V J4 Pwr jack center = (+) C1 4700uF IN Vreg OUT C2 10uF C3 0.1uF +5V Title: pktstim H/MDL POCKET STIMULATOR Designed by: WKD Document N 0001 Revision 1.0 Checked by: Date Oct. 20, 2001 Size A H Approved by: Sheet 1 of 1 0 1 2 3 4 5 6 7 8
C:\My Documents\Projects\LabEquip\PocketStim\pktstim.pcb (Silkscreen, Top layer, Bottom layer)
C:\My Documents\Projects\FESstim\Schematics\stimPCB.pcb (Silkscreen, Top layer, Bottom layer)
POCKET STIMULATOR BILL OF MATERIALS revised: oct-01 Ref What Vendor Vendor PN Cost Notes INTEGRATED CIRCUITS U1 PIC16F84-04/P, microcontroller, FLASH, 18-PDIP Jameco 145111 $ 5.95 U2 4N33 photodarlington optoisolator, 6-DIP Jameco 41030 $ 0.25 U3 78L05, 5V positive regulator, 100mA, TO-92 Jameco 51182 $ 0.17 CRYSTALS, OSCILLATORS X1 Resonator, ceramic w/ caps, 4.0 MHz Digi-Key X902-ND $ 0.56 SEMICONDUCTORS Q1 IRL520N HEXFET Power MOSFET, Ron=0.2ohm, 10A Digi-Key IRL520N $ 1.00 D1 Diode, 1N4004, 400V Jameco 177640 $ 0.05 PASSIVE COMPONENTS C1 Cap, electrolytic, radial, 4700uF, 25V Jameco 93850 $ 0.69 C2 Capacitor, 10uF 35V, dipped tantalum Jameco 33689 $ 0.49 C3 Capacitor, monolithic ceramic, 0.1uF, 50V, 20% Jameco 25523 $ 0.12 RA1 Resistor array, bussed, 10K, 8-pin SIP, 7 resistors Jameco 97826 $ 0.10 R1,R3-R5 Resistor, 1/4 W, 5% (garden variety, see schematic for values) R2 Pot, 10K, carbon, top adj, PC mount Digi-Key CT2265 $ 1.51 CONNECTORS J1 Audio jack, 3.5mm stereo, PC mount Digi-Key CP-3513 $ 0.69 J2 RJ11 modular jack, 6P4C, PC mount Jameco 105945 $ 0.49 J3 Header,.100", dual row, 8-pin Jameco 109516 $ 0.15 J4 DC Power jack, 2.1mm, male, pc board mount, Switchcraft RAPC722 Digi-Key SC1153-ND $ 1.08 EVERYTHING ELSE T1 Transformer, power, 6.3VCT/1.2A Jameco 102162 $ 5.95 LED1 LED, red, diffused, T1-3/4 Jameco 94511 $ 0.19 IC socket, machine tooled, solder, low profile, gold plated, 18 pin Jameco 65584 $ 0.49 Phone cable, gray, 4-cond, 100 ft Jameco 103430 $ 3.30 RJ11plug, 6P4C Jameco 79290 $ 0.11 Electrode cables (cut from six foot audio cable) All CB-387 $ 0.90 Electrode extension cables, 10 ft. All CB-371 $ 2.00 Battery, 9V Printed circuit board, ExpressPCB mini-board service, 3 boards $ 59.00 Adapter, modular to DB25M Jameco 66229 $ 2.19 Shorting block, blue Jameco 112441 $ 0.10 ALTERNATE PARTS Toggle switch, submini, SPDT, right-angle, PC mount Jameco 106067 $ 1.49 Battery snap, 9V male, PC mount Digi-Key 593K $ 0.20 Battery snap, 9V female, PC mount Digi-Key 594K $ 0.24 Page 1 of 1
C:\My Documents\Projects\LabEquip\PocketStim\pktstim.c Printed on Sunday, October 21, 2001 at 21:03:07 Page1 /*----------------------------------------------------------- ------------------------------------------------------------ FILE: pktstim.c DESCRIPTION: Code for "pocket" stimulator, the H/MDL simple, transformer output stage stimulator REVISION HISTORY: See end of file. ------------------------------------------------------------ ----------------------------------------------------------*/ //--Includes #include <16F84.H> //--Setup commands #fuses PAR,XT,NOWDT,NOPROTECT,PUT #id 0x1234 // 4 digit id #use delay(clock=4000000) // 4 MHz resonator #use fast_io(a) #use fast_io(b) //--Pin definitions #define TRIG PIN_B0 // ext trigger #define PLSEOUT PIN_B1 // output pulse command #define LED PIN_B2 // LED (low = on) #define SEL1 PIN_B4 // ext trig select (H=ext trig) #define SEL2 PIN_B5 // stim frequency select (H=25 Hz, L=1 Hz) #define SEL3 PIN_B6 // PW select (H=600uS, L=300uS) #define SEL4 PIN_B7 // reserved //--Global variables short trigflag; // stim trigger //--Function declarations void main(void); void stim(void); /*********************************************************** Code starts here ***********************************************************/ void main(void) { //----Initialize some things. set_tris_a(0); set_tris_b(0xf1); // port A is all outputs // port B (hi=input,lo=output) output_high(led); // LED off setup_counters(rtcc_internal,rtcc_div_256); // setup RTCC ext_int_edge(h_to_l); // high-to-low edge on ext stim trig disable_interrupts(global); // no ints for now enable_interrupts(int_ext); // enable external interrupts
C:\My Documents\Projects\LabEquip\PocketStim\pktstim.c Printed on Sunday, October 21, 2001 at 21:03:07 Page2 trigflag = 0; delay_ms(10); // let all i/o lines settle //----Main loop which runs forever while (1) { // do forever if (input(sel1)) { // external trigger enable_interrupts(global); // accept ints set_rtcc(100); // initialize counter while (!trigflag) { // wait for stim trig if (!get_rtcc()) output_high(led); // if ctr rolls over, turn off LED trigflag = 0; // reset flag else { // here if internal stim trig delay_ms(40); // wait 40 msec output_high(led); // then turn off LED if (!input(sel2)) // if 1 Hz stim stim(); delay_ms(960); // wait some more // stim pulse /*---------------------------------------------------------- Stim routine. Pulse for 300 or 600 usec. Using delay_us() routines gives acceptably (but not precisely) accurate pulses. For more accurate timing, see code for main lab stimulator. -----------------------------------------------------------*/ void stim(void) { output_high(plseout); delay_us(298); if (input(sel3)) delay_us(298); output_low(plseout); output_low(led); // start pulse // wait pw u-sec // check width selection // a double width pw // stop pulse // turn on the LED /*---------------------------------------------------------- External stim trigger interrupt service routine. Called on hi-lo transition of RB0/INT pin when interrupt is enabled. -----------------------------------------------------------*/ #INT_EXT void ext_int_handler(void) { trigflag = 1; disable_interrupts(global); // no more ints /*---------------------------------------------------------- REVISION HISTORY: 05/01 created by Durfee ----------------------------------------------------------*/