How do I give a radio control car autonomous control


Closed Thread
Results 1 to 40 of 191

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    I am not sure where this is all documented anymore. The PBP manual deals with the command line for compiling, PBP is a command line program.

    Now that you are getting HEXes. Start the PicKit2 software.
    After it starts if you do not have it connected to a PIC or you change PICs you will need to check communications.


    Then import the HEX.


    Click the "Write" button to squirt the HEX to the PIC.

    Now to make this automated click the "Auto Import" button. This brings up the open dialog to select a HEX. If you do this, each time you compile by hitting the F9 key in MCS the PICKIT2 software will re-load the HEX and write the PIC. The power can be turned ON/OFF with out changing the settings. Click the "Auto Import" again to go back to normal.
    Attached Images Attached Images    
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default Idiosyncrasies

    So far, so good.

    Interesting little issues.

    ONE, I tried to compile the BLINK.BAS that comes with Microcode Studio. It contained the placer "loop:". The compiler did not like that. It asked for a "do". I edited it to "mainloop". That made the compiler happy. It gave me a .hex file.

    TWO: I successfully loaded the .hex into the PIC. After the WRITE command is said Programming Successful. It does not run at all. No blinking of the LEDs. I asked for a verification of the program load. It said, "Verification Successful" I visually checked program memory against the .hex code. It downloaded correctly. Hmmmm...

    Guess I gotta learn how to use the debugger.

    One more thing. The Microcode Studio compiler accepted 16F877 as the PIC. The PICkit 2 PRogrammer insists it is a 16F887. It gives me no choice. All I can select is Midrange/Standard Configuration.

    Here is the BLINK.BAS that It compiled without complaint. I better go check the wiring. Maybe there is no LED atached to PORTB 0

    '************************************************* ****************************
    '* MICROCODE STUDIO TIPS *
    '* *
    '* (1) : To get context sensitive help, move your cursor to a PICBasic *
    '* : command and then press F1. *
    '* (2) : Program assumes the PIC is running at 4MHz. To change the default *
    '* : setting (for example, to 20MHz) simply add DEFINE OSC 20 at the *
    '* : top of your program. *
    '* *
    '* This sample program is supplied courtesy of microEngineering Labs Inc *
    '************************************************* ****************************

    ' Example program to blink an LED connected to PORTB.0 about
    ' once a second

    mainloop:
    High 0 ' Turn on LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds

    Low 0 ' Turn off LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds

    Goto mainloop ' Go back to loop and blink LED forever
    End


    Ken

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


    Did you find this post helpful? Yes | No

    Default I am wrong.

    My magnifying glass tells me that my PIC is a 16F887.

    I'll see if that makes any difference to the compiler.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    More instructions....

    Make sure the jumper is on JP1 on your board.
    Go to your PBP directory and find the file 16F887.inc
    That is where the PIC is configured. Make it look like below, we will set the fuses in the code. See the lines that are commented with ;
    Code:
    ;****************************************************************
    ;*  16F887.INC                                                  *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2006 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 05/26/06                                        *
    ;*  Version   : 2.47                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            include 'M16F88x.INC'	; PM header
        ;    device  pic16F887, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F887, r = dec, w = -302
            INCLUDE "P16F887.INC"	; MPASM  Header
        ;    __config _CONFIG1, _XT_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    Then compile this
    Code:
    '16F887 BLINK
       @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
       
       MAINLOOP:
       HIGH PORTD.0
       PAUSE 500
       LOW PORTD.0
       PAUSE 500
       GOTO MAINLOOP
    If you board is the same as the one here...
    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 I got it!!

    The 44 PIN Demo board users guide clearly (in font size ~2 print on Page 35) says that the LED's are attached to PORTD.

    I changed the .BAS code per below and the LED blinks!!!

    ---------------start snip---------------
    mainloop:
    High PORTD.0 ' Turn on LED connected to PORTD.0
    Pause 500 ' Delay for .5 seconds

    Low PORTD.0 ' Turn off LED connected to PORTD.0
    Pause 500 ' Delay for .5 seconds

    Goto mainloop ' Go back to loop and blink LED forever
    End
    --------end snip----------------

    Hurray for our team!!

    Ken

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


    Did you find this post helpful? Yes | No

    Default I just read what your last note.

    Thank you,

    I was looking for that include file, but could not find it.

    The printed documentation gave me the details about the board wiring.

    Onward and upward to bigger and better things.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    GREAT!!!!!!!!!!!! Glad you got it.
    Just for fun here is a "more advanced" blinky.
    You might get something out of it. You can add the comments
    Code:
    '16F887 BLINK
       @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
       DEFINE OSC 4
       TRISD = %00000000
       CNT  VAR BYTE
       MAINLOOP:
       FOR CNT = 0 TO 10
       HIGH PORTD.0
       LOW PORTD.1
       PAUSE 500
       LOW PORTD.0
       HIGH PORTD.1
       PAUSE 500
       NEXT CNT
       FOR CNT = 0 TO 100
       PORTD = %01
       PAUSE CNT
       PORTD = %10
       PAUSE CNT
       NEXT CNT
       GOTO MAINLOOP
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default Where do I find the definitions of all those aliases?

    You used many previously defined aliases in the two INCLUDE segments as well as inside our Blink'n code;

    '16F887 BLINK
    @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF

    Where are these listed? On what page of which .pdf file?

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    At or near the end of Microchips *.inc file.

    Can be found here
    C:\Program Files\Microchip\MPASM Suite

    This is the file that has pretty much everything about the chip in it.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Car radio (Car radio and electronics support forum)
    By freewillover in forum Forum Requests
    Replies: 1
    Last Post: - 1st July 2009, 20:41
  2. Remote Car Starter Safety
    By CocaColaKid in forum General
    Replies: 8
    Last Post: - 22nd November 2005, 10:10

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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