OKAY,
I have discovered through the use of my oscilloscope that PAUSE stops the HPWM output pulses. In order to emulate the radio system I want to try giving the ESC two seconds worth of neutral PWM between switches back and forth between forward and reverse. This is a race car. It will not be going backwards very often, but it is necessary sometimes. Looks like I need to figure out how to set a two second interrupt. Hmmmm. NUTS!
Ken
Hey Ken, welcome back to town.
Do you mind posting some of your code for us to figure out what is going on? The HPWM command, or using the CCP hardware PWM with your own commands should both work independently of your code. I have a 2 second pause that is repeated, but HPWM keeps pumping out pulses the entire time. But if I repeatedly call HPWM and set it using PBP, it can give me some screwy results. Probably better setting the registers directly, like Bruce shows in this example: http://www.picbasic.co.uk/forum/show...1478#post61478
What PIC hardware are you using?
Thanks,
Walter
http://www.scalerobotics.com
Here is the first couple commands of my code. I deliberately start HPWM then PAUSE for four seconds. My oscilloscope shows a flat line for four seconds then springs in PWM action.
I just looked at it again. I am no longer as certain as I was. Once I get into my code it seems to behave as I expect. I'll get back to you all tomorrow.
Thanks, Ken
The outputs of PORTC.1 and PORTC.2 are high all the time.
Why? In other code snippets PAUSE seems to allow action to continue. I hope you guys see that I am being stupid.
Code:' PORTC.0 'High is R/C. Low is PIC control TRISC = %11110000 main: low portc.0 gosub straightforward pause 4000 goto main end StraightForward: pwm 1,120,50 pwm 2,120,50 return
As soon as I typed "submit" I saw that I had left out the H in HPWM. Thank you sooo much!
Ken
First I used my 44 pin PIC (with no PICKIT 2 board) on a toy level car. Toy level means bang-bang control. It worked.
Now I am running a model level car with PWM control. I miss wired CCP1 and CCP2. Steering was going to the wheels. Driving was going to the steering servo.
I thought I had double checked this. Clearly my double checker was flawed. I shall rewire and report back.
Thank you for your patience.
Bookmarks