14M & PWMOut

c00kie

New Member
Hi,

I need to control the speed of a motor and modified some of Peter Anderson's code to test my H-bridge circuit. The code runs fine on an 08M chip but when I transfer it to a 14M chip there is no output. As far as i can see they are both supposed to use pin2 as the output and that's how I've got the circuit connected. Can anyone point me in the right direction?

Many thanks in advance!

Code:

---------------------------------------------------------

symbol PWMDuty = B0
symbol Counts = B1
symbol PWMDuty4 = W1

low 2


main: PWMDuty = 75

do
PWMDuty4 = PWMDuty * 4
pwmout 2 , 249, PWMDuty4
pause 50
PWMDuty = PWMDuty + 1
loop while PWMDuty < 250

pause 2000

do
PWMDuty4 = PWMDuty * 4
pwmout 2 , 249, PWMDuty4
pause 50
PWMDuty = PWMDuty - 1
loop while PWMDuty > 75

goto main
 

eclectic

Moderator
Legs and pins

Cookie.

1. Have a quick look at Manual 1, pages 70 - 72

2. Try your program in the simulator.
It works. Look for the PWM green symbol.

3. I've just tried your program on a real 14M, but using an LED as output.
It works, using
Leg 5.

HTH e.
 
Last edited:

hippy

Ex-Staff (retired)
Does "PWMOUT 2..." automatically turn leg 5 from an input to an output or must "pinsc" be set ?

This is one of those cases where the argument goes against tying unused inputs direct to 0V as incorrectly using a command which automatically turns an input into an output can blow the output pin, entire port or chip. It's not just incorrectly used commands but plugging a pre-programmed PICAXE into different hardware.
 

c00kie

New Member
Now working - thanks

I had the output connected to output 2 i.e. leg 11. This was due to me only having spotted the (very basic) pinout diagram of the 14M on page 20 of the same manual.

Thanks very much for your help (and for not saying RTFM!)

School buggy project now back on track.

All the best,

Mark
 
Top