Home    Worksheets    Subroutines   

Worksheet 101:
Buggy outputs
 

In this worksheet you will learn how the outputs of the Picaxe chip control the buggy.

You'll also learn 2 ways of setting the outputs

1) Start up the PICAXE Programming Editor program:  click here
  - Make sure that PICAXE-18x is selected (in View / Options...)
  - you should see the flowchart page. (if not, Click New / New flowchart or use the button)

2) Enter the following flowchart in Programming Editor:      
 
   
This program sets Output 0 to ON.
If you want to set other Outputs instead,
use:
, or
  etc. etc.

              

3) Download the program to the buggy:
  - connect up the download lead to the socket at the back of the buggy.
  - switch on the buggy,
  - Click on PICAXE/Run or click the button. (or use F5)

The PIC chip is now running the program.
Check to see what the buggy is doing.

4) The PicAxe chip has 8 outputs. They are numbered from 0 to 7.
Find out what they do.                      

Fill out the following table by running all 8 different versions of the above program:

Output

Function

0

1

2

3

4

5

6

7

  When You've worked out which outputs control the Motors and LEDs, fill in the "Buggy Outputs" section of your Buggy Journal.

 

So far you've used the PICAXE Programming Editor program in its Flowchart mode.

5) Now switch to Basic (use the   button)

This is your basic program:

 

'start of loop ---
      do
      let pins=%00000001
'end of loop -----
      loop
 
This program sets the Outputs to %00000001

If you want to set other patterns for the Outputs instead, use:
let pins=%00000100               , or
let pins=%00001000                etc. etc.

 

6) Find out what the different patterns of outputs do.                      

Fill out the following table by running the above program with all 8 different patterns:

Let pins=

Function

%00000001

%00000010

%00000100

%00001000

%00010000

%00100000

%01000000

%10000000

    

 

7) Binary Numbers.

Numbers such as "%10000000" are Binary numbers.

Its value depends on the positions where the 1s are found. Position 0 is on the right hand end.

 

Binary numbers can be converted to denary (your normal numbers to the base 10)
by using the following table.

 

Bit position

7

6

5

4

3

2

1

0

Denary value

128

64

32

16

8

4

2

1

 

For example: let pins = % 00001000

Bit position

7

6

5

4

3

2

1

0

Bit Value

0

0

0

0

1

0

0

0

Denary value

128

64

32

16

8

4

2

1

When Bit 3 is 1 (in binary) it is worth 8 in denary

 

So   let pins=%00001000    is equal to:    let pins = 8

The % means the number after it is binary.

 

Click on the three right hand digits of the binary number for a live display:

 

 

 

 

8) Now fill in the following table:

Buggy Movement

Binary

Denary

Forward

Let pins=% Let pins=

Reverse

Let pins=% Let pins=

Spin left

Let pins=% Let pins=

Spin right  

Let pins=% Let pins=

Turn left

Let pins=% Let pins=

Turn right

Let pins=% Let pins=
  When You've worked out the patterns for forwards, spin, turn etc, fill in the
 "Output Patterns" section of your Buggy Journal.

Hint: you add together the separate patterns for the left and right motors.


 

Assessment :
Before you've finished this worksheet, you need to show the teacher your work.
Make sure You've filled in your buggy Journal.

1) Keep this page on the screen with your answers filled in, so that the teacher can mark your work.

2) If you are told to, print out this page..     and hand it in for marking.


 

Content Scl Version 18/4/07