The following code makes the car go full speed backwards, then stop, then full speed forwards, then stop etc. Using the RC system I can control the motor continuously though varying speed. I have not yet figured what HPWM parameters produce various speeds to the ESC. It may be that the over-specification fast pulse frequency is overriding that nuance.
To really discover what this is doing I need to study and understand the ASM code. I think HPWM is interrupt driven. I am concerned because page 87 of the PBP Manual seems to say that the slowest pulse frequency is 245 hz. I want 50 hz.
Code:
'****************************************************************
'* Name : HPWMcommand.BAS *
'* Author : Ken Jones *
'* Notice : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 1/27/2010 *
'* Version : 1.0 *
'* Notes : PBP has a HPWM command. Let's try it. *
'* : *
'****************************************************************
' Don't forget. The duty cycle is 0 to 256 resolution
MAINLOOP:
HPWM 1,110,50 ' Neutral discovered by experiment.
PAUSE 5000
HPWM 1,64,50 ' Full backwards
PAUSE 2000
HPWM 1,110,50
PAUSE 5000
HPWM 1,164,50 ' Full forward
PAUSE 2000
goto mainloop
Ken
Bookmarks