PBP projects for R/C models


Closed Thread
Results 1 to 40 of 772

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default It surely did change the behavior.

    Bed time here on the east coast.

    I tried both
    OSCCON = %01110111
    and
    OSCCON = %01110001

    I got the PIC to read the PWM signal from the radio channel 3 by doubling the threshold for differentiation. I can toggle between PIC and radio control.

    But I have not been able to get the HPWM to behave. I tried using the original duty cycle. This made the wheels go backwards very fast no matter what was in the HPWM command. I tried doubling the duty cycle (to account for cutting in half the clock rate and the wheels did not turn at all. The Electronic Speed Control wants this PWM signal to arrive at 50 hz. In fact it is probably at 489Hz (according to page 87 of MicroEngineering Labs' PICBASIC PRO book). I'll put a 'scope on it tomorrow.

    I think the book says that HPWM channel, 127, 50 will be a square wave of 489Hz. Does that agree with you guys' thinking?

    I also have not gotten the PING echos to mean anything. The little red lights on the SRF05s are blinking. But my code is not making sense of the echo responses. I thought that all I would need to do was to double the expected echo pulse duration numbers.
    Ken

  2. #2
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    Bed time here on the east coast.

    I tried both
    OSCCON = %01110111
    and
    OSCCON = %01110001

    I got the PIC to read the PWM signal from the radio channel 3 by doubling the threshold for differentiation. I can toggle between PIC and radio control.

    But I have not been able to get the HPWM to behave. I tried using the original duty cycle. This made the wheels go backwards very fast no matter what was in the HPWM command.
    did you add :

    DEFINE OSC 8

    to your code somewhere near the top?
    Otherwise the PIC thinks you're still running at the default 4MHz.


    steve

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    The Electronic Speed Control wants this PWM signal to arrive at 50 hz.

    Ken
    No matter how you cut it, to get 50Hz (20mS period) using hardware PWM, the maximum clock frequency you can use is 0.819MHz (819KHz)
    Attached Images Attached Images  
    Last edited by rmteo; - 4th April 2010 at 04:55. Reason: - typo in numbers.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Darn,
    I thought the SRF05 was the same thing as the PING. Now I see that the SRF05 takes a different trigger pulse.

    So it looks like I just wasted your time on that part.

    I guess on the good side rmteo noticed another possible problem.

    I wonder if a While/Wend loop using PWM would be the answer?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default PWM per Electronic Speed Control specs.

    Originally Posted by Kenjones1935 View Post
    The Electronic Speed Control wants this PWM signal to arrive at 50 hz.

    I was not clear in my last posting. The Electronic Speed Control PWM specification is for a single positive pulse no less than 1ms and no more than 2ms once per 20 ms, ie 50 pulses per second. The one to two millisecond pulse width is divided into 256 parts. 1.5 ms corresponds to 128 which corresponds to neutral in a servo.

    Neutral is steering straight on a steering servo. Neutral is stopped on a wheel driving servo.

    I discovered that using HPWM with the 4mhz default oscillator a pulse width of 100 to 110 gets the behavior of 'neutral' on my car. For example "HPWM 1, 100, 50" turns the front wheels of my car to straight. See the attached picture. Channel 2 is the HPWM version of neutral. Channel 3 is what the radio receiver sends.

    Ken
    Attached Images Attached Images  

  6. #6
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Talking Progress - er, at least using my head.

    I have found a way to make short, 10 to 80 usec pulses while using the 4mhz oscillator. The SRF05 proximity detector wants at least 10 usec. If I give it super long pulses catching the following echo measurement can be a problem for PULSIN.

    Sooo the following makes an 80 usec positive pulse.

    SYMBOL trigright = PORTB.0
    LOW trigright
    HIGH trigright
    HIGH trigright
    HIGH trigright
    LOW trigright.

    One thing at a time.

    Ken

  7. #7
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Question speed is elusive.

    I now have the sonic ping devices (SRF05's) flashing continuously. There is no blockage in the PIC's processing.

    Now the car is reacting too quickly. There is a bit of code that used to guarantee a 1/2 second backing up when backing up was necessary. Now the count down for this delay is instantaneous. While turning a corner the proximity sensor data gets confusing. Both the side sensors and the forward sensors are hearing important echos. I might need to adjust the positions of the two SRF05's or write some code especially for that situation. I am not sure - elusive. Like I said.


    Ken

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Hope you are not activating both sensors at the same time, right? Be sure to give some time for the echo to decline enough before confusses the other sensor.

    Ioannis

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11:26
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. Making PBP code more modular
    By forgie in forum General
    Replies: 30
    Last Post: - 25th October 2005, 16:24

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts