Recent Changes - Search:

Introduction to Microcontroller Programming

About PICmicro Chips

Clocking Your PICmicro Devices

E-Blocks

Flowcode Step By Step

PICmicro Projects

Labs

Lab 3 - Connection Point

<^< 2. Delay | Course Index | 4. Calculations >^>

1. Introduction

A Connection Point or ‘Goto’ instruction is often used to create an infinite loop, to repeat a set of instructions over and over again. This, in fact, is not the most ideal instruction as the ‘Loop’ instruction is much better for this task. The difference with a Loop, as you will experience later on, is that a Connection Point can be used to jump out of a loop to a certain location in the program.

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 methodXTALSW2: XTALS2: XTAL
R/C clock speed   
Xtal frequency19.660.800 Hz  
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
OptionsSetting
Clock speed19 660 800 Hz
Simulation speedAs fast as possible
OptionsSetting
Device16F1937
RC/XTXTAL
Watchdog timerOff
5. Software learning objectives

Output, binary code training, creating an infinite loop, what a goto instruction is, compiling a program to the PIC, clocking the PIC, PIC microcontroller basics.

6. Hardware learning objectives

LED’s, logic output levels, Multiprogrammer basics.

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). The Connection Point icon is introduced in (step 8). 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.

Also 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 make an infinite loop with a Connection Point icon and learn what software implemented ‘PWM’ is.

8. Labs
Letter Meaning
L Lab x
B Basic complexity
I Intermediate complexity
E Expert complexity
L3-B1
Use the Delay, the Output and the Connection point icons to alternately light the even and odd LEDs of port B on and off with 300msec intervals over and over again in a never ending loop. Test this step by step in the Flowcode simulator by using the step-into function.
L3-B2
Use the Delay, the Output and the Connection point icons to alternately flash the high nibble and low nibble LED's of port B on and off with 300msec intervals over and over again in a never ending loop. Download the program to the PIC and test it.
L3-B3
Use the Delay, the Output and the Goto instruction to flash all the LED's of port B on and off with 500msec intervals over and over again in a never ending loop.
L3-I4
If you make the delays of program [L3-B3] very short and make the on and off times asymmetrically, then you have designed a software 'Pulse Width Modulation' (PWM). (search for PWM on the internet if this is not clear to you) For instance: make the on-time 8msec and the off-time 12msec. Download this program to the PIC and look at the LEDs. You will see that the intensity of the LEDs is lower now. This happens too fast for your eyes to see the LED's go on and off, but you can see the intensity change if you change the relation between the on- and the off-time (t-on + t-off stays the same in all the situations). PWM is used in light dimmers and also to control the speed of DC motors and the position of Servo motors.
L3-I5
Write a program that lights the 4 MSB’s of port B constantly on, and that dims the light intensity of the 4 LSB’s of port B, using PWM. The difference in intensity of the MSB’s and the LSB’s should be very clear if you download the program to the PIC and test it.
L3-I6
If you have an oscilloscope, use it to visualise the signal that is sent by the PIC to one of the four LSB’s. Make a detailed drawing of the screen of the oscilloscope and make sure that the voltage and timing details are on the drawing. Make a note on the drawing on what on-time and off-time you used in the Flowcode program.

<^< 2. Delay | Course index | 4. Calculations >^>

Print - Search - Login

Page last modified on May 13, 2013, at 03:21 PM