PBP projects for R/C models - Page 9


Closed Thread
Page 9 of 20 FirstFirst ... 567891011121319 ... LastLast
Results 321 to 360 of 772
  1. #321
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Smile DAVE, you fixed it!!

    COUNT is the solution. This is BIG. My target RC car is the HPI Sprint. In comes in a Ready To Run package for around $200 including a two channel radio system. I have been using channel three to make the TOGGLE between R/C and PIC control. This is an expensive variation. Now a plain vanilla RTR Sprint should do the job! THANK YOU.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    COOOOOL!!!!!

    I can not wait to see new videos.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Question What is the best way to learn 8 bit Assembly?

    I have "16 BIT LANGUAGE TOOLS GETTING STARTED" DS70094E. My 16F887 is an 8 bit machine. What is the best way for me to learn ASM for my PIC? I have not been able to get MPLAB IDE v8.33 to work. Is that because I am dealing with an 8 bit PIC?

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    MPLAB should work with any PIC. What is it not doing?

    Assembly???
    Hang out here
    http://www.piclist.com/techref/piclist/index.htm
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default It did not like the ASM code

    I gave MPLAB IDE some .asm code created by MicroCode Studio. It claimed too many errors. That was many months ago. I'll try again.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    In the Project drop down from the tool bar - select language toolsuit, select:
    Microchip MPASM Toolsuite

    That should then compile ASM generated by PBP.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default Yes, but....

    That's the way I have been compiling.

    When I cut and paste a .asm that was created by the compiler into the MPLAB IDE application window it refused to assemble. I think there are some idiosyncrasies that I need to learn.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    Maybe the wrong PIC was selected?
    Toolbar-Configure-Select device
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default PICKIT 2 Programmer Application??

    I've built my first solderless proto using a 40 pin 16F887.

    As far as I can tell I have duplicated the actions that up until now have worked. The PICKIT 2 Programmer "Check communication" says "PICKIT 2 found and connected" "PIC device found"

    However when I click the Write button using the 40 pin PIC, the PICKIT 2 Programmer application says "Programming failed at program memory address LOCATION 0x000002"

    Any ideas?

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    Some possible causes. Maybe...
    Are both VDDs and VSSs connected?
    Do you have capacitors across both VDDS and VSSs?
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Smile It's working

    No sure what was wrong. Maybe a solderless connection was not tight.

    Got a couple warning windows about voltage must be 4.5v.
    Strange since the power is coming from my PC via the USB port. Then that went away. Got a couple of red "Code Protect" statements. Had to restart the application to get ride of them.

    Twice in a row it loaded my .hex file successfully. Good!! Now to adding sonars, SN7404 and the DPDT relay.

    Thanks for the support. It really helps!

    Ken

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


    Did you find this post helpful? Yes | No

    Default Hpwm??

    How do I learn exactly what the 16F887 does when given a HPWM PBP command? Seems to me the car's electronic speed control (and hence the car) reacts slower to PIC PWM signals than to radio control PWM commands.

    I was wondering if throwing a LOW at the PWM output port might slow the car down quicker than just changing HPWM commands from 'forward' to 'reverse'.

    Is this a potentially worthwhile path of inquiry? Something is slower than it should be and it is not the sensor trigger rate.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    I want to use the interrupt system to make my Pulse Width Modulated pulses output at 50hz. I am hoping that will give me finer control of the wheel speed and maybe a quicker steering response.

    I understand that I need to preset TMR1 with a number so that it rolls over every 20 ms. thereby triggering the interrupt. How do I figure out what that preset number should be and how do I set it using PBP?

    Ken
    I wonder if something like this could be made to work for you?
    http://www.picbasic.co.uk/forum/showthread.php?t=7393
    or
    http://www.picbasic.co.uk/forum/cont...gle-Modulation)
    Dave
    Always wear safety glasses while programming.

  14. #334
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Cool chip for R/C PWM: 18F2431 series

    After reading about some of Bruce's cool projects with the 18F2431 series chips, I have been playing around with them for a little while. One thing that caught my eye is that they can do Power Control PWM as low as 19 hertz (while running at 40 mhz). Something you have to bring other chips OSC down to 0.5 mhz to do. This, and a few more of it's features, make it pretty nifty for creating PWM servo output. I mocked up a quick test, and have been able to do about 10bit PWM 1 to 2ms pulses at the proper 50 hertz spacing on 3 pins with the 18F2431. The larger chips of this series can do 4 pin PCPWM. I will post a little code once I get it cleaned up a bit.
    Last edited by ScaleRobotics; - 26th July 2010 at 18:15.

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


    Did you find this post helpful? Yes | No

    Question The new Electronic Speed Control is messing with my head

    I received a brand new HPI Racing Sprint car. This is the same model which I have been using. It is just the most recent version.

    I am having a problem with the new Electronic Speed Control a SC-15. It has some kind of mind of its own. My old code which told my old car where to go is not working with this new ESC.

    Do any of you have the contacts to get me the specs on this "SC-15 ESC WITH REVERSE SPORT CONTROL".

    Does is have a PIC? Is it programmable? What are its design algorithms?

    Ken

  16. #336
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Servo pwm passthrough using PCPWM

    The 18F2431 makes it slightly easier to perform servo PWM because it's PCPWM module can go down to 19 htz while maintaining fast OSC rates, unlike other PIC chips HPWM. Here is an example of using the PCPWM to output 3 servo signals. This specific example senses the pulses (up to 5 channels) by using the CCP1 capture pin. To get 5 channels into one pin for PW capture, channels 1, 3 and 5 are input using small signal diodes. Then, since this drops the signal down to under 3 volts, I used two 2n3904 transistors. One to boost up the voltage, and the other one to invert the signal back to normal. (It was all I had lying around). Somehow, you will need to boost your signal after the diodes for the CCP1 capture to sense the incoming pulses.

    Note: Because the PCPWM was used, this will not work on any chip outside of the 18F2431 family.

    Code:
    ;This only works on a 18F2431 family device with Power Control PWM (PCPWM)
    ;By Scale Robotics Inc. 
    ; The input signal should look something like this:- 
    ;
    ;        |<------------------ 1 frame (~20mS) -------------->|
    ;        |<1~2mS>                                 
    ;         ______        ______        ______                  ______
    ; _______|      |______|      |______|      |________________|      |____
    ;   gap    ch1    ch2    ch3    ch4    ch5      sync  gap      ch1    etc
    define OSC 40
    asm
        __CONFIG    _CONFIG1H, _OSC_HSPLL_1H
        __CONFIG    _CONFIG2H, _WDTEN_OFF_2H & _WDPS_512_2H
        __CONFIG    _CONFIG4L, _LVP_OFF_4L
    endasm
    clear 
    ADCON0 = %00000000
    ADCON1 = %00000000
    portb=0
    trisb = %11000000
    trisc = %00000110
    trisa = %00000000
    DTCON = %00000101   'dead time for complimentary ouputs
    PTCON0 = %00001101  '1:1 postscale, Fosc/4 1:64 prescale, Sincle Shot mode
    PTPERL = 255        ' 
    PTPERH = 251
    PWMCON0 =%01010000  'PWM[5:0] ouputs enabled
    PWMCON1 = 1         'updates enabled, overrides sync w/timebase
    PTCON1 = %10000000  'PWM timebase is on, counts up
    FLTCONFIG = %00000010 'disable fault A, cycle by cycle mode
    CCP1CON = %00000101    'Capture mode; every rising edge
    
    duty1 var word        'width of outgoing pulse1
    duty2 var word  'duty values 625 to 1250 = 1 to 2 ms pulse (Center at 625)
    duty3 var word
    risetime1 var word    'Rise Time for incoming pulse1 
    risetime2 var word
    risetime3 var word
    falltime1 var word     'falltime for incoming pulse1
    falltime2 var word
    falltime3 var word
    pulsewidth1 var word    'pulse width for incoming pulse1
    pulsewidth2 var word
    pulsewidth3 var word
    pulsewidth4 var word     
    pulsewidth5 var word
    pulseNumber var byte
    pulseNumber = 1         'tells which pulse we are reading
    CCP1CON.0  = 1
    timerone var word 
    timerone = 60315 ;
    
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System 
    ASM
     
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR5_INT,   _PulseOut,   ASM,  yes
            INT_Handler   CCP1_INT,   _PulseMeasure,   ASM,  yes
            INT_Handler   TMR0_INT,   _TimeOut, ASM, yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
     
    T1CON = %00110001            ;Timer1 used by CCP1 capture
    T5CON = $01                  ;used as pulseout timer
    T0CON = %11000111              ; Prescaler = 8, TMR1ON
    
    @   INT_ENABLE  TMR5_INT     ; Enable Timer 1 Interrupts            
    @   INT_ENABLE  CCP1_INT      ; Enable Capture Compare for pulse width measurement
    @   INT_ENABLE  TMR0_INT    ; deadtime (sync gap) indicator for lull between pulses
    Main:
            pause 10
            'do something to these values if you want to filter, center, etc
            'Below we are just passing values through
            duty1 = pulsewidth1 >>1  'send channel 1 out PCPWM on PortB.1
            duty2 = pulsewidth3 >>1  'send channel 3 out PCPWM on PortB.3
            duty3 = pulsewidth5 >>1  'send channel 5 out PCPWM on PortB.4
    GOTO Main
     
    '---[TMR5_INT - interrupt handler]------------------------------------------ 
    PulseOut: 'set up pulse width values for pulseout and reset single shot bit
        TMR5L = timerone.byte0
        TMR5H = timerone.byte1
        PDC0L = duty1.lowbyte
        PDC0H = duty1.highbyte
        PDC1L = duty2.lowbyte
        PDC1H = duty2.highbyte
        PDC2L = duty3.lowbyte
        PDC2H = duty3.highbyte
        PTCON1.7=1  'resets single shot PTEN bit
    @    INT_RETURN
        
    '---[CCP1_INT - interrupt handler]------------------------------------------
    PulseMeasure:
    if CCP1CON.0  = 1 then ; Check CCP1M0 for rising edge watch
        select case pulseNumber
            case 1
                TMR0L = 0    'reset timeout timer0
                TMR0H = 0
                risetime1.lowbyte = CCPR1L
                risetime1.highbyte = CCPR1H
            case 2
                TMR0L = 0    'reset timeout timer0
                TMR0H = 0
                risetime2.lowbyte = CCPR1L
                risetime2.highbyte = CCPR1H    
            case 3
                TMR0L = 0    'reset timeout timer0
                TMR0H = 0
                risetime3.lowbyte = CCPR1L
                risetime3.highbyte = CCPR1H
        End select 
        @ BCF     CCP1CON, CCP1M0 ; Now capture the trailing edge     
    Else     'check for falling edge time
        @ BSF     CCP1CON, CCP1M0 ; Re-set for trailing edge capture
        select case pulsenumber
            case 1
                falltime1.lowbyte = CCPR1L
                falltime1.highbyte = CCPR1H
                pulsewidth1 = falltime1 - risetime1
            case 2
                falltime2.lowbyte = CCPR1L
                falltime2.highbyte = CCPR1H
                pulsewidth2 = risetime2 - falltime1
                pulsewidth3 = falltime2 - risetime2
            case 3
                falltime3.lowbyte = CCPR1L
                falltime3.highbyte = CCPR1H
                pulsewidth4 = risetime3 - falltime2
                pulsewidth5 = falltime3 - risetime3
        end select 
        pulsenumber = pulsenumber + 1 'get ready for next channel
            
    endif
    @    INT_RETURN
    '---[TMR0_INT - interrupt handler]------------------------------------------
    TimeOut:
        pulsenumber = 1 'if pause between pulse in exceeds about 7 ms, get ready
        'to receive pulse 1 (senses dead time between pulse bursts)
    @   INT_RETURN
    To see a similar project, but using SPWM, look here: http://www.picbasic.co.uk/forum/showthread.php?t=12657
    Last edited by ScaleRobotics; - 28th July 2010 at 19:08.

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


    Did you find this post helpful? Yes | No

    Default Thank you, Dave

    Yes, the 18F2431 looks like a winner for my PWM construction. It is included in my PICkit2 programmer.
    It comes in a 40 pin package. It would easily replace my 40 pin 16F887 on the solderless protoboard. To use it effectively I need to master ASM coding. I have not succeeded in cracking that nut.

    Here is my latest stumbling block. I have an arrangement with some folks who are willing to contribute brand new HPI Racing Sprint cars to my project. I received my first new car last week. HPI has drastically changed the Electronic Speed Control. This is the package that translates incoming PWM signals (from the radio receiver or from my PIC) into outgoing DC current for the motor that drives the wheels. I am not doing well with the HPI WEB site getting technical information about this SC-15 WITH REVERSE SPORT CONTROL.

    Ken

  18. #338
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    Here is my latest stumbling block. I have an arrangement with some folks who are willing to contribute brand new HPI Racing Sprint cars to my project. I received my first new car last week. HPI has drastically changed the Electronic Speed Control. This is the package that translates incoming PWM signals (from the radio receiver or from my PIC) into outgoing DC current for the motor that drives the wheels. I am not doing well with the HPI WEB site getting technical information about this SC-15 WITH REVERSE SPORT CONTROL.
    Hey Ken,

    Congratulations on getting the donation! It is a great idea you have, and I am glad you have stuck with it. As for your newest stumbling block, what code are you currently using? You might be running into the same problem of not having a standard R/C output pulse going to the controller. And MIBAM will not work, because it is meant for lighting, and will confuse your speed controller even more.

    All analog servos (not the newer digital ones) use a standard protocol. A pulse width from about 0.9mS to 2.1mS or so, pulsed every 20 mS. Since this controller does not say digital on it, I would bet that it is analog, and works the same as all the servos in my house. Since it has reverse, as well as forward, I would bet that somewhere in between .9mS and 1.1 mS is neutral. Less is probably reverse, and more is forward.

    I don't think you need a manual for it. Just start feeding it some PWM that matches that protocol, and you will be good.

    Assembly is a tough nut to crack. It's just one of those things, the more you use it, the more you learn. But one of the things I learned this week from the forum, was that I could have an instant ASM interrupt without using any ASM. No, I didn't know that when I wrote some similar code for the 12f683. So in my example above, I only used two lines of assembly code. a BSF and a BCF. (Bit set and bit clear). So you can have almost no nuts with this code, or you can change them to PBP code if they drive you ... um ..... nuts.

    I think you already know this, but I just found the gif file, and I like it, so I'll post it here. - Walter

    Attached Images Attached Images  
    Last edited by ScaleRobotics; - 29th July 2010 at 16:04.

  19. #339
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    All analog servos (not the newer digital ones) use a standard protocol. A pulse width from about 0.9mS to 1.1mS or so, pulsed every 20 mS.
    I was always led to believe it was typically 1ms to 2ms with a 20ms frame rate this gave 1.5ms pw for centre stick, at least that's what I've always based my SSC type projects on.

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


    Did you find this post helpful? Yes | No

    Default I think this ESC is different

    I agree with both of you on the size, shape and frequency of standard PWM signals. I have been running my car (an older version of this same HPI Sprint) successfully for the last couple of months. With the exception of frequency my HPWM pulses agree with your specs. I found the correct HPWM commands by trial and error.

    This new Transmitter, Receiver, ESC combo is different. Leaving out my PIC for the moment if I on the radio transmitter I give full forward (trigger full back) and suddenly go to full reverse (trigger full forward) the car goes from full forward to stop (neutral in the PWM sense) and stays there until I bring the trigger to neutral for at least two seconds. Then giving it full back will work fine.

    Somewhere in the system is protection against slamming the DC motor with reversed polarities. That is good, but when I tried to emulate that system in my code it did not work.

    Thank you sooo much for your support and interest. Oh, yes, the electronic speed control wheel driving system is not a classic servo. Steering is. Wheels used to be - in the day - but no longer.

    Ken

  21. #341
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    I was always led to believe it was typically 1ms to 2ms with a 20ms frame rate this gave 1.5ms pw for centre stick, at least that's what I've always based my SSC type projects on.
    Edit: oops, yes I meant to say 2.1 as the highpoint, not 1.1. Thanks Malc!

    Hey Malc,
    Yeah, me too! As a basic rule it works. But then I built my first passthrough device, I built it for that range and it got discombobulated when the signals from my transmitter exceeded the 2 mS. My transmitter has endpoint adjustments, so it allows you to go beyond the 1 to 2 mS. Some transmitters will only give 1.1 to 1.9ms.

    Check out the HiTech web site regarding the signals:

    Quote Originally Posted by HiTech
    Q. What signal do servos require to operate?
    A. All Hitec servos require a 3-4V peak to peak square wave pulse. Pulse duration is from 0.9ms to 2.1ms with 1.5ms as center. The pulse refreshes at 50Hz (20ms).
    You are probably right, I just was not sure if a forward and reverse speed control would be centered at 1.5 mS. My planes don't have reverse.
    Last edited by ScaleRobotics; - 29th July 2010 at 16:04.

  22. #342
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    Leaving out my PIC for the moment if I on the radio transmitter I give full forward (trigger full back) and suddenly go to full reverse (trigger full forward) the car goes from full forward to stop (neutral in the PWM sense) and stays there until I bring the trigger to neutral for at least two seconds. Then giving it full back will work fine.

    Somewhere in the system is protection against slamming the DC motor with reversed polarities. That is good, but when I tried to emulate that system in my code it did not work.
    Ken
    Well, that's a completely different problem than what I thought you had. Why not talk to your friends at the R/C store and find out if they know of any controllers that let you go reverse from full forward. If they do, sell the controllers you have on Ebay, and buy the ones you want with the money?

    You might also be able to hack the speed controller if it is for a brushed motor. But you run the risk of breaking a $55 speed control. You could also build your own controller for a brushed motor, but easier to find one off the shelf that will do what you want, if it exists.
    Last edited by ScaleRobotics; - 29th July 2010 at 18:20.

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


    Did you find this post helpful? Yes | No

    Default Yea, but...

    I have been successful in attracting some support for my project. Check out
    http://www.ten80education.com

    They use HPI Sprint cars.
    If I can design a 'simple' enough PIC kit to add to the standard HPI product, the schools might get a pretty good deal. My new car was a support gift cost me nothing.

    Ken

  24. #344
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post

    This new Transmitter, Receiver, ESC combo is different. Leaving out my PIC for the moment if I on the radio transmitter I give full forward (trigger full back) and suddenly go to full reverse (trigger full forward) the car goes from full forward to stop (neutral in the PWM sense) and stays there until I bring the trigger to neutral for at least two seconds. Then giving it full back will work fine.

    Ken
    Electronic braking system. - You might be able to go into the programming mode and disable this function.

  25. #345
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    Electronic braking system. - You might be able to go into the programming mode and disable this function.

    Uhmm maybe that's not an option. I can't see anything on programming the end points on this controller

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


    Did you find this post helpful? Yes | No

    Default Just got back into town...

    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

  27. #347
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    I have discovered through the use of my oscilloscope that PAUSE stops the HPWM output pulses.
    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

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


    Did you find this post helpful? Yes | No

    Red face I'm using a 16F887

    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

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


    Did you find this post helpful? Yes | No

    Default Here's some code.

    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

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


    Did you find this post helpful? Yes | No

    Default I see it already

    As soon as I typed "submit" I saw that I had left out the H in HPWM. Thank you sooo much!

    Ken

  31. #351
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Glad to hear it. The bad news is that HPWM doesn't go down as low as 50 hertz, unless you use a really low osc speed. You have to go down to 0.5 mhz to get there. And, unfortunately you have to tell pbp that it is running at 4mhz. This will make a pause 2000 16 seconds. It can be compensated for, but a bit of a pain. And it limits you to 32 steps of speed. I think I talked about this back on post 199. Maybe that's why you tried to go back to PWM. But as you saw, PWM is effected by blocking commands, like pause.

    http://www.picbasic.co.uk/forum/show...5908#post85908

    I don't have a 16F887, but I just ordered a sample, so I can help test some options for you.

    Walter
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default I also miss wired!!!

    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.

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


    Did you find this post helpful? Yes | No

    Smile wiring correctly eases understanding BASIC

    Yup,

    Now when it sees something in front it stops then goes backwards. And when nothing is in front it goes forward for all its worth. Such a difference getting the steering servo and the wheel electronic speed control signals actually going to the servo and the ESC.

    Now to calibrate HPWM for this fancy ESC. It seems very similar, but not exactly like the old not-so-fancy ESC. There are still funny rules around switching from forward to reverse and visa verso.

    Ken

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


    Did you find this post helpful? Yes | No

    Smile It's working

    Another 'minor' problem. The new HPI Sprint has the steering servo mechanically opposite my older car. With this car steering right is smaller PWM pulses. Steering left is larger.

    Soooo Things are working as they used to. My problem now will be getting a reaction time that is reasonable given the speed of the car. I have not taken it to a gym or outside. When I hold a big cardboard in front of the car it does turn. Soon enough? We'll see... I can slow down the wheels, but this is supposed to be a race car.

    Ken

    Ken

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


    Did you find this post helpful? Yes | No

    Smile New car - its first outing

    It worked better before I went in and to get my video camera. However, you can get the idea from this clip. There are still some mysteries with the HPI's new Electronic Speed Control SC-15.



    Little by little....

    Ken

  36. #356
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    I think the car is been autonomous enough and wants to escape now! Was very funny how it got away under the white car!

    Keep up the good work Ken.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default I ran for two minutes autonomously

    This afternoon I taped a two minute video in which my new HPI Sprint car ran autonomously around and around the inside of our garage. The radio transmitter was turned OFF during the whole episode. At no time in this piece did I interrupt the PIC control with the radio control. I was operating the video camera.

    Go to:
    http://www.youtube.com/watch?v=jI5JEeT_FDE

    What do you think?

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    Very nice!!!
    Almost looks like it was "thinking" after it hit something.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Smile What version of code is in my PIC

    If I have recorded the checksums how can I know which version of code is on my PIC?

    The PIC KIT 2 programmer has a READ button. Does that read the contents of my program memory and display for me to see its checksum?

    I have not figured out on-line debugging. Actually I have not figured out a great deal of stuff in this system.

    Ken

  40. #360
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    If I have recorded the checksums how can I know which version of code is on my PIC?
    Yes, it will display the checksum after it reads the code from the PIC chip.

    You could use the verify button. It will compare the file loaded onto the pickit from your computer to what it reads on the PIC chip. It will notify you of any differences.
    http://www.scalerobotics.com

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 : 4

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