Here is the result. It changes from off through the percentage points to all the way on, but the period remains constant at about 1.023ms. (I finally got my oscilloscope USB driver to work today!)
![]()
Here is the result. It changes from off through the percentage points to all the way on, but the period remains constant at about 1.023ms. (I finally got my oscilloscope USB driver to work today!)
![]()
Thank you soooo much. What a great tool..
Two things for me to consider.
1. PAUSE seems to not have the affect I expected.
2. The PR2 constant must mean something to PBP, but I can not figure out what.
Lastly, which version of oscilloscope software do you use? Is it freeware or did it cost money. If so, how much?
Ken
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
I think I am being told that HPWM can not do the job that I need done. Who has a suggestion?
Did you just open the floor to my broken record again?! Here is my view, but I agree, you (we all) need to hear more viewpoints than mine.
Darrel Taylor Interrupts using TMR0 for pulse width, and TMR2 for 20ms period, and receiver pulse width sensing with CCP1_INT and TMR1. Your chip has them, just need to utilize them.
If you always have an RC receiver on, then you can use that as your time base for 20ms. So, you could use the CCP1_INT to read the pulse width coming from the receiver. (This will use TMR1). Then you could use TMR0, or TMR2 for the pulse width. Every time you calculated the pulse from your CCP1_INT, you would send out your servo pulse on whatever pin you like, or control multiple pins, using the same timer.
You really just need to start playing around with these timers and interrupts, and pulse some pins to get your head around it. But without a scope, it will be pretty difficult in my opinion.
Here some scope info that you asked me about. It is a stand alone, but has a USB port and free software that comes with it. It cost just under $300.00. http://picbasic.co.uk/forum/showthread.php?t=12483
Last edited by ScaleRobotics; - 27th January 2010 at 21:45.
Ken,
Can you do a LED blinky without using PAUSE (or any other delay commands)? Try to do a 1 second blinky using a timer. When you can do that, you will be well on your way to solving your motor ESC problem.
Bookmarks