Recent Changes - Search:

Introduction to Microcontroller Programming

About PICmicro Chips

Clocking Your PICmicro Devices


Flowcode Step By Step

PICmicro Projects


Lab 1 - Output

1. Introduction

The first exercises on microcontrollers in any course are always on outputs. What better way to visualize output levels than with LEDs.

2. Setting up the equipment
3. Hardware settings
EB006 OptionsSettingJumper settings (EB006)Jumper settings (HP488)
Power supplyExternal, 14VJ29: PSUJ29: PSU
PICmicro device16F1937  
Programming methodUSBJ12,13,14: USBJ20: USB
Clocking methodRCSW2: RCS2: XTAL
R/C clock speedSLOWSW1: SLOW 
Xtal frequencyN/A  
LVP Jumper selectionI/O PortJ11,16,17: I/O PortJ15,16,18: I/O
Port A E-block   
Port B E-blockLED board  
Port C E-block   
Port D E-block   
Port E E-block   
4. Flowcode and download settings
Build > Project Options... > General Options Build > Project Options... > Configure
Clock speed19 660 800 Hz
Simulation speed10
Watchdog timerOff
5. Software learning objectives

Output, binary code training, compiling a program to the PIC, clocking the PIC, PIC microcontroller basics.

6. Hardware learning objectives

LED’s, logic output levels, Multiprogrammer basics, current limiting resistor between PIC and LEDs.

7. Instructions

Construct the system shown from E-blocks.

In the course navigate to the ‘Flowcode step-by-step’ and review the section on Digital outputs (step 2). To understand Masking you will need to review the section on Decisions (step 7). In the course you will also find the sections on Clocking your PIC, and about PIC microcontroller basics useful. The descriptions of the Multiprogrammer board and the led board are in the E-blocks section.

Make use of the Help-function in Flowcode to get the info you need.

During these exercises you are going to send different 8-bit codes to port B of your Microcontroller. You'll also learn how to change the logic level of only one single pin of port B. In RC mode the clock is quite slow. In XTAL mode it is very fast.

8. Labs
Letter Meaning
L Lab x
B Basic complexity
I Intermediate complexity
E Expert complexity
Use a single output icon that lights all of the LED's of Port B.
Alter the icon parameters so it puts only the odd LEDs of Port B 'on'
Now put only the even LEDs of Port B 'on'.
Now put the High nibble (bits 4 to 7) of Port B 'on'
In steps 1 to 4 you used a decimal number between 0-255 that you sent to Port B, start using the Hexadecimal notation to send a value to Port B. Repeat the ex. 1-4 with Hex notation.
Put only the LED on PB7 'on' by sending an 8-bit value to this port.
Put only the LED on PB7 'on' by using the 'Single bit' output method.
Put only the LED on PB7 'on' by using the 'Masking' output method.
Write a program with at least 20 Outputs icons that writes different values to Port B, one after the other, and review what the result is in simulation. Use all of the 4 different methods in this exercise: Hexadecimal, Decimal, Single bit and Masking. Slow down the simulation speed from 'as fast as possible' to the speed that fits you best to visualize the different output values.
Download the program to the PIC. Configure both the Multiprogrammer and flowcode to work in slow RC mode. Review the section on 'clocking your PIC' if this it not clear to you. Restart the program in the PIC over and over again by pressing the reset button on the Multiprogrammer board.
Draw up the full circuit diagram of the PIC with 8 LEDs on Port B, including the clocking circuit, the reset circuit, VDD and VSS connected to the PIC and the correct current limiting resistors connected between LED and PIC. If you made a circuit of this drawing, and connected power to it, it should perform exactly the same as the E-blocks system in front of you. Schematics in the E-blocks section will come in handy when you do this task.

Print - Search - Login

Page last modified on May 14, 2013, at 02:49 PM