User manual

Table Of Contents
PICDEM
TM
Lab Development Board User’s Guide
SD41369A-page 12 © 2009 Microchip Technology Inc.
1. Initalize():
- Initializes the microcontroller, the peripherals used in the application and any
global variables used by multiple functions.
2. Get_Inputs():
- Obtains any input information either on-chip (from internal registers, etc...) or
off-chip (pin voltage levels).
3. Decide():
- Makes decisions based on the input information gathered in the previous
function to manipulate global variables.
4. Do_Outputs():
- Based on the decisions made in the previous function, this function outputs
data onto the pins of the microcontroller or to registers within the device.
5. Timing():
- This function determines how fast the software control loop executes.
Example 2-1 shows a typical main() calling the various functions that make up the
software control loop.
EXAMPLE 2-1: TYPICAL SOFTWARE CONTROL LOOP MAIN() USED IN
LABS
An infinity loop will be used by all labs in this user’s guide created using a while
loop that repeatedly call the functions within the curly braces as long as there is power
to the microcontroller.
Global variables are used wherever needed in lieu of passing variables between
functions.
2.4 MPLAB
®
IDE DOWNLOAD INSTRUCTIONS
The following steps outline how to download the latest version of the MPLAB IDE and
HI-TECH C
®
PRO for the PIC10/12/16 MCU Families compiler. It is strongly recom-
mended that all open programs and applications are closed to expedite the installation
process.
void main(void)
{
Initialize(); //Initialize the relevant registers
while(1)
{
Decide();//Make any decisions
Do_Outputs(); //Perform any outputs
Timing();//Sets execution rate of the
//Software Control Loop
}
}