Recent Changes - Search:

Introduction to Microcontroller Programming

About PICmicro Chips

Clocking Your PICmicro Devices

E-Blocks

Flowcode Step By Step

PICmicro Projects

Labs

Slow Simulation

<^< Adding the Switches | Course Index | Decisions >^>

Flowcode allows you to progress through the flowchart one step/icon at a time. You can watch the effect of each step on the variables and on the output. Note that this program will also be fully functional when simulating 'As fast as possible'.

  1. There are three ways to run the program step-by-step:
    1. Click on the 'Run' button on the Main toolbar and then click on the 'Step Into' button (Run > Step Into).
    2. Press the F8 function key on the keyboard.
    3. Click on the 'Step Into' button on the main toolbar in the simulation section.
Do one of these!
  1. Several things happen.
    1. A red rectangle appears around the 'BEGIN' icon, showing that this is the current step.
    2. The 'Simulation debugger' window appears - containing Variables and Macro Calls.
    3. The Variables section lists the three variables that you defined for this program, and shows their current values - all zero at the moment.
Ignore the 'Macro Calls' section for the moment.
  1. Now set up two numbers on the switch components.
Move the cursor over the switch box connected to Port B.
Click on switches B0, B1, and B3, to activate these switches. The switches should now look like this:
You have set up the binary number 000 1011 (which is the number eleven in decimal.)
Switch B6 gives the most significant bit of the number, and B0 the least significant bit.
Set up the number 000 1111 (fifteen) on the switches connected to Port C.
  1. Now Step Into to the next icon in the program by, for example, pressing F8 once more.
  2. The red rectangle moves on to the next icon, the Loop icon, but little else happens.
  3. Press F8 once again. The red rectangle moves on to the first Input icon.
  4. Press F8 again and the Variable box shows that the 'input1' variable now contains 11. This is the result of the Input instruction just carried out.
  5. Press F8 again and the Variable section shows that 'input2' now contains 15.
  6. Press F8 again and the Calculation is carried out. The 'sum' variable stores the result.
  7. Press F8 again. The value stored in 'sum' is transferred to the LEDarray.
It looks like:
Reading from Most significant bit (D7) to Least significant bit (D0), the LED array shows the number 0001 1010. In decimal, this is the number 26. No surprises there then!
  1. Repeat step 3 using different numbers, and step through the program to check what the sum of the numbers is.

The program is finished, and working. As usual, you could now let Flowcode translate it into machine code, and burn it into a PICmicro chip.

<^< Adding the Switches | Course index | Decisions >^>

Print - Search - Login

Page last modified on June 14, 2013, at 03:52 PM