Once I added the L293 board and motor I have been killing my 18M2's. There is no magic smoke, but the program doesn't drive the motor like it should and when I try to re-program the chip I get a "hardware not found" error message. I did modify the CHI030 board by replacing the Darlington drivers with a 330 ohm array. Is there a problem with the wiring diagram? see attached. I also included the code in case I did something glitch there.
View attachment Wiring Diagram PWM0001.PDF
Code:
'******************Auto Turret.bas****************
'Version 1.2
'AJZ/Sept. 10, 6:23 PM
'The sentinel is controlled by a 4 channel transmitter/receiver
'When the Channel button on the transmitter is pressed,
'the corresponding channel on the receiver goes high
'Channel A drives the turret left
'Channel B drives the turret right
'the limit of rotation is determined by Hall effect sensors
'motor is GM3 or equivalent, 5 volt 3 RPM
'When the power is applied to the shield, the turret rotates back and forth
'In addition the sound of an alien recording is played during rotation
'===Variables===
b10 = 199 ' PWM duty cycle; adjust for speed
'===Constants===
symbol abit = 500 'sets short pause interval
Symbol Chan_A = pinC.2 'Assign receiver channel A to Port C.2
Symbol Chan_B = pinC.0 'Assign receiver channel B to Port C.0
Symbol Chan_C = pinC.4 'Assign receiver channel C to Port C.4
Symbol Chan_D = pinC.1 'Assign receiver channel D to Port C.1
Symbol Limit_L = pinC.5 'Assign left travel limit to Port C.5
'Hall sensor goes low when magnet approach
Symbol Limit_R = pinC.6 'Assign right travel limit to Port C.6
Symbol slave = pinC.7 'Assign auto-rotate latch to Port C.7
'B.7 & C.7 are jumpered together
symbol enable = B.3 'motor speed
symbol in1 = B.2 'determines motor direction HI/LO
symbol in2 = B.0 'determines motor direction HI/LO
symbol LED = B.1 'fires LED
symbol beep = B.4 'makes "alien recording" noise
symbol chirp = B.5 'makes "strange alien" noise
symbol gun = B.6 'makes "alien machine gun" noise
symbol master = B.7 'toggles auto mode on & off
'===Directives===
#com 1 'specify serial port
#picaxe 18M2 'specify processor
'#no_data 'save download time
'#terminal of 'disable terminal window
'============== Begin Main Program ==========================
dirsB = %11111111 'all outputs
outpinsB = %00110100 'set B.2, B.4 & B.5 high
dirsC = %00000000 'all inputs
low enable
pwmout enable, 199,199 '5000Hz at 25% @ 4MHz
disconnect 'disable serin
auto:
high beep 'activate "strange alien" sound
pause abit 'a momentary pulse activates
low beep 'a 30 second sound bite
if Limit_L = 0 and _
Limit_R = 0 then 'turret is out of the limits
gosub left 'rotate turret left
end if
If Limit_L = 1 then 'turret is in left limit
pause abit
gosub right 'rotate turret right
end if
If Limit_R = 1 then 'turret is in right limit
pause abit
gosub left 'rotate turret left
end if
goto auto
left:
high in1 : low in2 'high B.2 low B.0 go left
pwmduty enable, b10 'run motor
do until Limit_L = 1 'until limit made
loop
low enable 'low B.3 stops motor
pause abit
return
right:
low in1 : high in2 'high B.0 low B.2 go right
pwmduty enable, b10 'run motor
do until Limit_R = 1 'until limit made
loop
low enable 'stop motor
pause abit
return