2.3 Programming (Part 1)

Submitted by Canabots on February 1, 2009 - 7:35pm.

So if you decided to use the BS2 for transmitting the RC signals, you'll need to download the PBASIC 2.5 software for free from Parallax.com .

 

Open a new file and save it as anything you want. Copy the following code into the window and click "Run".

BS@ Programming environment"Run" Button (Debugs and runs the program)

 

This is the test program I wrote for the robot to go forwards and back, and left and right for half second delays.

 

 

'  RC Surveillance Robot Test Program. Change the length of delays (in milliseconds) and decide when you would like the robot to turn or change direction by modifying the following code.

'www.Canabots.webs.com

'www.societyofrobots.com

'{$PBASIC 2.5}

'  Mainline
    DIR0 = 1                      '  P0 through P3 is an output
    DIR1 = 1
    DIR2 = 1
    DIR3 = 1

    DO

PAUSE 500       ' Delay 500ms
        OUT0 = 0                  '  Motors Forward
        OUT1 = 1
        OUT2 = 0
        OUT3 = 1
        PAUSE 500                 '  Pause half second
        OUT0 = 1
        OUT1 = 0                  '  Motors Backwards
        OUT2 = 1
        OUT3 = 0
        PAUSE 500                 '  Pause half second
        OUT0 = 0
        OUT1 = 1
        OUT2 = 1
        OUT3 = 0
        PAUSE 500                 '  Turn for half a second
        OUT0 = 1
        OUT1 = 0
        OUT2 = 0
        OUT3 = 1                  '  Turn the other way for half a second

    LOOP                          '  Repeat

 

 

 

If you decided to use the PIC16F684, then follow the instructions to downloading MPLab IDE and Hi-Tech's PICC Lite Compiler.

 

After, go to "Project", and then "New Project". Name it what you want and choose a directory. Then, you will need to download all the files at the bottom of this page. Two of these are header files, the other two are C program files.

 

Next, make sure your project files window is open. Right click on the section called "Header Files" and add the files always.h and delay.h. Then, right click on "Source Files" and add the files delay.c and Transmitter.c.

 Loading Header and Source files

 

Voila! Compile and program the code to you microcontroller. Turn on your circuit and your robot will do sequenced movements!!!

 

In the third and final part of this tutorial, I will demonstrate how you can implement basic teleoperation onto you Micro RC Surveillance Robot!

AttachmentSize
C and Header Files.zip5.01 KB

missing info

You are missing "the third and final part of this tutorial" =P

Also, got video of the teleoperation?

Almost there

Teleoperation still needs a bit of work. There are some bugs that need to be fixed, bit right when that's done, I'll definitely let you know!!!!!