DV164101 Microchip Technology, DV164101 Datasheet - Page 50

KIT DEV PICKIT1 FLASH 8/14PIN

DV164101

Manufacturer Part Number
DV164101
Description
KIT DEV PICKIT1 FLASH 8/14PIN
Manufacturer
Microchip Technology
Series
PICkit™ 1r
Type
MCUr
Datasheets

Specifications of DV164101

Contents
PIC Kit 1 Circuit Board, CD-ROMs, USB Interface Cable and Booklet
Processor To Be Evaluated
PIC12F675
Interface Type
USB
Silicon Manufacturer
Microchip
Core Architecture
PIC
Core Sub-architecture
PIC12, PIC16
Silicon Core Number
PIC12F, PIC16F
Silicon Family Name
PIC12F6xx, PIC16F6xx
Rohs Compliant
NA
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Microchip's 8-14 Pin FLASH Microcontrollers
For Use With
AC164122 - BOARD DAUGHT PICTAIL SD/MMC CARDAC164120 - BOARD SIGNAL ANALYSIS PICKIT
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
DV164101R
DV164101R

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DV164101
Manufacturer:
Microchip Technology
Quantity:
135
PICkit
C.4
DS40051D-page 46
LESSON 2 – INTRODUCTION TO STATE MACHINES
1 Flash Starter Kit User’s Guide
State Machines are an integral part of software programming. State machines make
code more efficient, easier to debug and help organize the program flow. State
machines are not limited to just firmware, they can be used to streamline any system.
However, this document limits the scope of state machines to microcontroller firmware.
C.4.1
C.4.1.1
A Finite State Machine (FSM) is based on the idea of there being finite number of states
for a given system. For instance, when an application turns an LED on and off, two
states exist; one state is when the LED is on and the other is when it is off. The example
firmware that this document refers to turns on eight LEDs sequentially. Only one LED
is on at a time, therefore eight states exist. Each state consists of one LED being turned
on while all the rest are off.
State machines require a State Variable (SV). The SV is essentially a pointer that keeps
track of the state that the microcontroller is in, and directs the program flow to the
corresponding software module. The SV can be modified in the software modules (or
states) themselves or by an outside function. The example firmware uses an outside
function which detects a button press to advance through the states.
C.4.1.2
The introduction briefly mentioned some advantages of state machines. These advan-
tages are worth studying in greater detail because they are what make programming
with state machines so rewarding and beneficial to firmware developers.
The first advantage is using state machines inherently promotes good firmware design
techniques. When beginning to implement an application, think about what states are
necessary to make the application work. List all the pieces, or states, of an application
and then explore how they tie to one another. This will help prevent developing bugs in
the code. This line of thinking also leads to the development of a very useful engineer-
ing tool – the flow chart. The following paragraph covers state machine development in
greater detail.
State machines have one characteristic that cause them to be very beneficial. They
always return to one spot (or jump station) in the code at which the program flow is
channeled, by the state variable, to the corresponding software module. This provides
several advantages. First, this characteristic makes calling repetitive tasks on a regular
basis quite simple. Clearing the watchdog timer, checking for I/O button presses or
communicating with a host that requires periodic communication are examples of
repetitive tasks. The alternative to using state machines is to use looping code. In order
for looping code to handle repetitive tasks, the functions that handle these tasks must
be distributed throughout the code in each of the loops. This is not only highly inefficient
but also confusing to understand. Figure C-5 shows a block diagram of what the
example code would look like if a state machine where not used. Compared to
Figure C-6, which shows a block diagram of state machine based code, it is clear that
using a state machine cuts down on code space and the likelihood of missing a
repetitive task call.
Design
WHAT IS A STATE MACHINE
BENEFITS OF STATE MACHINES
 2004 Microchip Technology Inc.

Related parts for DV164101