Step 4:  Programming the IO

Clear previous program

Clear previous

To begin a new program, you should CLEAR the previous one.  You can do this with either the button or by typing clear.


A program that uses IO


For the BASICchip in the PROstart, the LED is connected to P0(1).  

   WHILE X<30
       IO(1) = X and 1    ' IO() sets pin direction and state
       X=X+1
       WAIT(500)
    LOOP

For the PRO type the following program in the console window.

                                  ' enable pin P0(15) is connected to the LED
WHILE X<30
  IO(15) = X AND 1       ' drive pin 15 high when x is odd, low when x is even
  X=X+1
  WAIT(500)
LOOP

For the SuperPRO and PROplus. Use the following if you have firmware 8.12 or later (includes floating point support)

                                 ' port 2 starts at 64
   WHILE X<30
       IO(64+10) = X and 1
       X=X+1
       WAIT(500)
    LOOP

For earlier versions of the SuperPRO and PROplus, use the following

   #include <LPC17xx.bas>

   FIO2DIR = FIO2DIR OR  (1<<10)
   WHILE X<30
       P2(10) = X and 1
       X=X+1
       WAIT(500)
    LOOP

Now RUN the program

Now RUN the program

The LED on the PCB should pulse 15 times.


And see the results

And see the results


Stop the program


Stop the program

To stop a running program simply press the Stop button.

On to Step 5