In your first program you forgot the "@ device"-statement. This statement is neccessary for every program! How should the PIC knows to initialize his oszillator ?
And use the "DEFINE OSC"-statement !
In your first program you forgot the "@ device"-statement. This statement is neccessary for every program! How should the PIC knows to initialize his oszillator ?
And use the "DEFINE OSC"-statement !
PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2
Yes and no, it goes much than this... using 20MHz, you can't produce a 1KHZ frequency. The lowest would be around 1.221 KHz...
It's all explain in the PBP manual OR showned in my PicMultiCalc.
<img SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1318&stc=1&d=116838497 7">
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
like i said I tried that:
Here is the code, it does not work, it always stays on high
@ DEVICE PIC16F88, MCLR_ON, HS_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
PAUSE 100 ' start-up delay
DEFINE CCP1_REG PORTB 'Hpwm 1 pin port, RIGHT
DEFINE CCP1_BIT 3 'Hpwm 1 pin bit
TRISA = %11111111 ' Set PORTA to all input
TRISB = %00000000
loop:
PORTB.4=1 'Enable B+ Both motors forward
PORTB.5=0 'Enable B-
PortB.6=1 'Enable A+
PortB.7=0 'Enable A-
HPWM 1,127,2000 'enable pin 13 Now for the speed of each motor
pause 5500
HPWM 1,210,2000
pause 5500
Goto loop 'Do it forever
end
Last edited by lerameur; - 10th January 2007 at 00:05.
about now?Code:HPWM 1,127,1300 'enable pin 13 Now for the speed of each motor pause 5500 HPWM 1,210,1300
EDIT: it's working here...
Last edited by mister_e; - 9th January 2007 at 23:56.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I decided to put it at 5000
HPWM 1,127,5000 'enable pin 13 Now for the speed of each motor
pause 5500
HPWM 1,210,5000
pause 5500
and it works
thanks guys
Bookmarks