Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, chipKIT,
chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net,
dsPICworks, dsSPEAK, ECAN, ECONOMONITOR,
FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP,
Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB,
MPLINK, mTouch, Omniscient Code Generation, PICC,
PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE,
rfLAB, Select Mode, Total Endurance, TSHARC,
UniWinDriver, WiperLock and ZENA are trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
7.1.1F1 LV Evaluation Platform Schematic (1 of 4) .......................................38
7.1.2F1 LV Evaluation Platform Schematic (2 of 4) .......................................39
7.1.3F1 LV Evaluation Platform Schematic (3 of 4) .......................................40
7.1.4F1 LV Evaluation Platform Schematic (4 of 4) .......................................41
DS41614A-page 4 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM
USER’S GUIDE
Preface
NOTICE TO CUSTOMERS
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu, and then Topics to open a list of available online help files.
®
IDE online help.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
F1 LV Evaluation Platform User’s Guide. Items discussed in this chapter include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Document Revision History
DOCUMENT LAYOUT
This document describes how to use the F1 LV Evaluation Platform User’s Guide as a
development tool to emulate and debug firmware on a target board. The manual layout
is as follows:
• Chapter 1. “F1 LV Evaluation Platform Overview”
• Chapter 2. “Getting Started”
• Chapter 3. “Programming the F1 LV Evaluation Platform”
• Chapter 4. “Demo Code”
• Chapter 5. “Hardware Libraries and Drivers”
• Chapter 6. “Troubleshooting”
• Chapter 7. “Schematics”
2011 Microchip Technology Inc.DS41614A-page 5
F1 LV Evaluation Platform User’s Guide
CONVENTIONS USED IN THIS GUIDE
This manual uses the following documentation conventions:
DOCUMENTATION CONVENTIONS
DescriptionRepresentsExamples
Arial font:
Italic charactersReferenced booksMPLAB
Emphasized text...is the only compiler...
Initial capsA windowthe Output window
A dialogthe Settings dialog
A menu selectionselect Enable Programmer
QuotesA field name in a window or
dialog
Underlined, italic text with
right angle bracket
Bold charactersA dialog buttonClick OK
N‘RnnnnA number in verilog format,
Text in angle brackets < >A key on the keyboardPress <Enter>, <F1>
Courier New font:
Plain Courier NewSample source code#define START
Italic Courier NewA variable argumentfile.o, where file can be
Choice of mutually exclusive
arguments; an OR selection
Represents code supplied by
user
®
IDE User’s Guide
“Save project before build”
4‘b0010, 2‘hF1
any valid filename
[options]
errorlevel {0|1}
var_name...]
void main (void)
{ ...
}
DS41614A-page 6 2011 Microchip Technology Inc.
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly.
Sending in the Warranty Registration Card entitles users to receive new product
updates. Interim software releases are available at the Microchip web site.
RECOMMENDED READING
This user’s guide describes how to use the F1 LV Evaluation Platform. Other useful
documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
Readme for F1 LV Evaluation Platform User’s Guide
For the latest information on using F1 LV Evaluation Platform User’s Guide, read the
“Readme for F1 LV Evaluation Platform User’s Guide.txt” file (an ASCII
text file) in the Readmes subdirectory of the MPLAB
Readme file contains update information and known issues that may not be included
in this user’s guide.
Readme Files
For the latest information on using other tools, read the tool-specific Readme files in
the Readmes subdirectory of the MPLAB IDE installation directory. The Readme files
contain update information and known issues that may not be included in this user’s
guide.
Preface
®
IDE installation directory. The
2011 Microchip Technology Inc.DS41614A-page 7
F1 LV Evaluation Platform User’s Guide
THE MICROCHIP WEB SITE
Microchip provides online support via our web site at www.microchip.com/F1LVEval.
This web site is used as a means to make files and information easily available to
customers. Accessible by using your favorite Internet browser, the web site contains
the following information:
• Product Support – Data sheets and errata, application notes and sample
programs, design resources, user’s guides and hardware support documents,
latest software releases and archived software
• General Technical Support – Frequently Asked Questions (FAQs), technical
support requests, online discussion groups, Microchip consultant program
member listing
• Business of Microchip – Product selector and ordering guides, latest Microchip
press releases, listing of seminars and events, listings of Microchip sales offices,
distributors and factory representatives
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip
products. Subscribers will receive e-mail notification whenever there are changes,
updates, revisions or errata related to a specified product family or development tool of
interest.
To register, access the Microchip web site at www.microchip.com, click on Customer
Change Notification and follow the registration instructions.
The Development Systems product group categories are:
• Compilers – The latest information on Microchip C compilers and other language
tools. These include the HI TECH C
pilers; MPASM™ and MPLAB ASM30 assemblers; MPLINK™ and MPLAB
LINK30 object linkers; and MPLIB™ and MPLAB LIB30 object librarians.
• In-Circuit Debuggers – The latest information on the Microchip in-circuit
debugger, MPLAB ICD 2, ICD3, PICkit™ 3.
• MPLAB
Integrated Development Environment for development systems tools. This list is
focused on the MPLAB IDE, MPLAB SIM simulator, MPLAB IDE Project Manager
and general editing and debugging features.
• Programmers – The latest information on Microchip programmers. These include
the MPLAB PM3 device programmers and PICkit™ 3 development programmers.
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
C16, MPLAB C18 and MPLAB C30 C com-
DS41614A-page 8 2011 Microchip Technology Inc.
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com
DOCUMENT REVISION HISTORY
Revision A (November 2011)
• Initial Release of this Document.
Preface
2011 Microchip Technology Inc.DS41614A-page 9
F1 LV Evaluation Platform User’s Guide
NOTES:
DS41614A-page 10 2011 Microchip Technology Inc.
Chapter 1. F1 LV Evaluation Platform Overview
1.1INTRODUCTION
Thank you for choosing the F1 LV Evaluation Platform. This kit allows you to begin
development using the PIC16LF1947 microcontroller (MCU).
The PIC16LF1947 is the first in a family of enhanced mid-range microcontrollers.
These architectural enhancements allow for more memory and faster computation than
that of legacy PIC16 microcontrollers.
The PIC16F1 and PIC12F1 family of microcontrollers are a series of 8-bit
microcontrollers derived from the popular PIC16 series of 8-bit PIC
The F1 LV derivatives feature an enhanced CPU, support for extended amounts of
memory, improved peripherals, and XLP low power. The F1 LV Evaluation Platform
allows you to evaluate these features for your application in a simple, low-cost platform.
This chapter introduces the F1 LV Evaluation Platform:
• Platform Contents
• Hardware Features
F1 LV EVALUATION PLATFORM
USER’S GUIDE
®
microcontrollers.
1.2PLATFORM CONTENTS
The F1 LV Evaluation Platform contains the following items:
1. F1 LV Evaluation Platform Demo Board – www.microchip.com/
1.3HARDWARE FEATURES
The F1 LV Evaluation Platform has the following hardware features:
1.3.1PIC16LF1947
The PIC16LF1947 is a 64-pin full-featured device, including:
1. Enhanced PIC16 instruction set
2. 16K words of Flash memory
3. 1K of RAM
4. 256 bytes of EEPROM
5. 2 CCPs and 3 enhanced CCPs
6. MSSP (I
7. Enhanced USART
8. 8- and 16-bit timers
9. 32 MHz internal oscillator
10. Low-power 32 kHz crystal oscillator
11. LCD controller
12. LF Operating Range: 1.8-3.6V
2
C™, SPI)
F1LVEval
1.3.2MCP9800 I2C™ Temperature Sensor
The MCP9800 is a low-power, I2C temperature sensor with selectable 9 to 12 bits of
output resolution.
2011 Microchip Technology Inc.DS41614A-page 11
F1 LV Evaluation Platform User’s Guide
1.3.3PICkit™ 3 Programming/Debug Header
The PICkit 3 is a low-cost development tool that allows programming and debugging of
the PIC16LF1947 MCU using the PICkit ICSP™ header.
1.3.4MCP2200 USB to Serial Converter
The MCP2200, with the associated driver, makes the F1 LV Evaluation platform appear
as a serial port when connected to a PC. The demo code includes utilities to control the
various add-on boards through this serial interface.
1.3.5Two Push Buttons, One Potentiometer, 7 LEDs
Simple applications need the basic user interface elements. Two push buttons, one
potentiometer and 4 green LEDs are available for any application. The remaining three
LEDs are used as indicators, a red LED is used to indicate the board is powered, the
remaining two LEDs are green and indicate RX/TX communication through the USB
Serial Converter.
1.3.6One Custom LCD
The LCD glass supplied on this board is a Microchip custom display with icons for a
battery indicator, 4 large numerical digits, 2 small numerical digits, adjustable decimal
point, colon for time keeping, 4 function mode (Fx) indicators, 8 segment bar, a
three-segment battery power indicator and 1 custom Microchip symbol. The
PIC16LF1947 makes controlling the LCD very simple.
1.3.720-pin Add-on Connector
This connector expands the F1 LV Evaluation Board with optional add-on boards.
Currently, there are 4 motor control add-ons planned or in production. The
PIC16LF1947 has complete control of 3 phases, so other 1, 2, or 3-phase motor
topologies are supported.
1.3.8Current Monitoring Connector
To demonstrate the Extreme Low Power (XLP) features of the PIC16LF1947, a
precision ammeter can be connected to the current monitoring connector. This allows
your application to be easily optimized for the lowest possible current.
1.3.9Generous Prototyping Area
Our circuits are not your circuits. A prototyping area has been provided to extend the
functionality of this demo board to demonstrate the utility of the PIC16LF1947 in your
application.
1.3.10MCP1640 Synchronous Boost Regulator
The MCP1640 is a compact, high-efficiency, fixed frequency, synchronous step-up
DC-DC converter. Through the use of this component, the F1 LV Evaluation board has
the option of boosting an AAA 1.8V battery to 3.3V, which is then used to power the
board and supporting circuitry.
1.3.11MCP1703 LDO Regulator
The MCP1703 is a low-dropout voltage regulator with a 250 mA maximum output.
Through the use of this component, the user has the option of powering the F1 LV
Evaluation board through the USB Serial Converter connector. The USB supplies 5V,
and the MCP1703 reduces this to the operating voltage of 3.3V.
DS41614A-page 12 2011 Microchip Technology Inc.
F1 LV Evaluation Platform Overview
1.3.12User Selectable Power Sources
The F1 LV Evaluation board operates at 3.3V and comes with a flexable range of
powering options.
• J5 – (EXT SUPP) The user can power the board from a external power supply
connected to the +/- headers.
• J6 – (EXP PWR) The user can power the board from any Add-on board through
the expansion connector.
• J7 – (AAA BATT) The user can power the board by inserting a single AAA battery
into B1 battery clamp.
• J8 – (USB PWR) The user can power the board by connecting a USB cable to J2
USB SERIAL CONV header.
2011 Microchip Technology Inc.DS41614A-page 13
F1 LV Evaluation Platform User’s Guide
NOTES:
DS41614A-page 14 2011 Microchip Technology Inc.
2.1INTRODUCTION
This chapter gives instructions to get your F1 LV Evaluation Platform powered up and
running the default demonstration. The following sections include:
• Powering the F1 LV Evaluation Platform
• Default Firmware
• Programming the F1 LV Evaluation Platform with the PICkit™ 3
• Measuring the current consumption
FIGURE 2-1:F1 LV EVALUATION PLATFORM
F1 LV EVALUATION PLATFORM
USER’S GUIDE
Chapter 2. Getting Started
2011 Microchip Technology Inc.DS41614A-page 15
F1 LV Evaluation Platform User’s Guide
2.2POWERING THE F1 LV EVALUATION PLATFORM
The PIC16LF1947 supplied with your F1 LV Evaluation Platform requires a supply
voltage of 1.8V-3.6V. Voltages above 3.6V will degrade or damage the device. There
are five ways to supply the necessary power.
1. Use PICkit 3
Select Power Supply Source via cross jumper configuration
2. External Power Source, J5
3. Use the Add-on Expansion Header, J6
4. Use an AAA Battery, J7, or
5. Use USB Cable, J8.
2.3POWERING WITH PICkit™ 3
To power with the PICkit 3, perform the following steps:
1. Make sure a jumper or an ammeter is connected across J4.
2. Configure the PICkit 3 to supply a voltage between 1.8 and 3.6V. For proper LCD
contrast, the supply should be 3.3V.
3. Attach the PICkit 3 to the PICkit ICSP™ connector at the end of the board.
4. Activate the PICkit 3 power output.
Note:When powering from the PICkit 3, all power supply jumpers (J5 - J8) should
be removed.
FIGURE 2-2:POWERING FROM PICkit™ 3
DS41614A-page 16 2011 Microchip Technology Inc.
2.4POWERING FROM EXTERNAL POWER SUPPLY
To power from an external power supply, perform the following steps:
1. Make sure a jumper or an ammeter is connected across J4.
2. Connect V
3. Verify the supply voltage to be between 1.8 and 3.6V. For proper LCD contrast,
the supply should be 3.3V.
4. Populate EXT PWR jumper, J5.
5. Turn on the power supply.
FIGURE 2-3:POWERING WITH EXTERNAL POWER SUPPLY
REF+ to EXT SUPP (+), connect VREF- to EXT SUPP(-).
Getting Started
2011 Microchip Technology Inc.DS41614A-page 17
F1 LV Evaluation Platform User’s Guide
2.5POWERING WITH THE ADD-ON EXPANSION HEADER J3
The add-on expansion hardware will supply the F1 LV Evaluation board with 3.3V DC
through use of a linear regulator. This allows the 5-12V motor power supply to power
the PIC16LF1947. J3, pin 6, is the source for the 3.3V power. To use this power
perform the following steps.
1. Make sure a jumper or an ammeter is connected across J4.
2. Verify that any attached PICkit 3 is not supplying power.
3. Populate the EXP PWR jumper, J6.
4. Attach the add-on expansion board.
5. Connect power to the add-on expansion board.
FIGURE 2-4:EXPANSION SLOT POWER
2.6POWERING WITH A AAA BATTERY
To power with a single AAA battery, the MCP1640 Boost Regulator is used to take the
supplied 1.8V and convert it to 3.3V.
1. Make sure the jumper or an ammeter is connected across J4.
2. Insert AAA battery into B1 battery clip.
3. Populate AAA BATT jumper, J7.
FIGURE 2-5:POWERING FROM BATTERY
DS41614A-page 18 2011 Microchip Technology Inc.
2.7POWERING WITH A USB CABLE
To power with the USB cable, perform the following steps:
1. Make sure a jumper or an ammeter is connected across J4.
2. The USB cable will supply 5V DC to the F1 LV Evaluation board. The MCP1703
converts the 5V to 3.3V supply voltage for the PIC16LF1947.
3. Populate the USB PWR jumper, J8.
FIGURE 2-6:USB POWER
Getting Started
2.8DEFAULT FIRMWARE
The default firmware supplied with your F1 LV Evaluation Board Demo performs the
following functions:
1. Blink LEDs
2. Measure the ambient temperature
3. Run an attached add-on board motor (the firmware will auto-detect the add-on
motor type, or indicate if no add-on board is attached.)
4. Display time/temperature/pot position/motor RPM on the LCD
5. User interface with a button and pot
For the latest firmware go to www.microchip.com/F1
2.8.1Blinking LEDs
LED RA4 is used to indicate timing of the demonstration main loop. The LED toggles
at each cycle through the demonstration program main loop. LEDs RA6, RA7 and RC5
are add-on board dependent, their function will change depending on the add-on board
attached.
2.8.2Measuring the Ambient Temperature
The MCP9800 is polled when in Temperature Measurement mode. The measured
temperature is filtered, scaled to either Centigrade or Fahrenheit and displayed on the
LCD.
LVEval
2011 Microchip Technology Inc.DS41614A-page 19
F1 LV Evaluation Platform User’s Guide
2.8.3Add-on Motor Expansion
A main task of the demo code is to allow the user to connect any of the expansion
add-on motor boards and have the PIC16LF1947 determine the motor type and adjust
the drive accordingly. The code provided with the F1 LV Evaluation board works with
the following add-on boards:
- BLDC (DM164130-2)
- BDC (DM164130-6)
- Unipolar Stepper (DM164130-7)
- Bipolar Stepper (DM164130-8)
2.8.4LCD Display
The time, temperature, pot position and motor speed are displayed on the LCD. The
LCD is a display with multipurpose icons. The display uses 4 commons and 28
segment drives. The Timer1 oscillator is used to clock the display peripheral and allow
the LCD to display data even in Sleep. Normally, the Timer1 counter would be used to
drive the display, but this timer is required for the BLDC software. This requires
configuring the LCD peripheral for a Type B waveform for this demo. The Type B
waveform requires coordinating LCD updates when the peripheral is ready. The BLDC
Interrupt requirements preclude using the built-in LCD interrupt for update
coordination, therefore, the LCD interrupt is polled as part of the main loop. Type A
waveforms can update the display without the extra coordination complexity. The
different waveform types are described in section 21.9 of the PIC16LF1947 data sheet
(DS41414). Because the LCD is clocked from the 32.768 kHz crystal, the LCDIF
operates at a multiple of the crystal frequency, providing a very accurate time base for
the real-time clock.
2.8.5User Interface
Due to the extreme simplicity of this board, only a single button and a single pot are
available for user input. A MCLR button is also present for the demonstration, this will
function as a master clear switch. These two elements allow the user to cycle through
the display elements, change the motor speed and change the time.
Pressing and releasing the button cycles through the following display modes:
1. Add-on Motor Indicator
2. Setable AM/PM Clock
3. 24-hr clock with seconds
4. Temperature (C)
5. Temperature (F)
6. POT ADC Value
7. Motor RPM (BLDC and stepper motors only)
By holding down the RD2 button during the Setable Clock mode, the minutes will begin
to increment. The minutes will increment from 0-9; when the minutes increment past 9,
the minutes will begin to increase by factors of 10. When incrementing reaches an hour,
the hours will begin to increment and the minutes will stay at 00. The AM/PM indicator
will automatically change accordingly. To set the clock, first set the hours and release
the button. Then, set the tens of minutes and release the button. Finally, set the
seconds. To synchronize the seconds, increment the minutes one final time at the
instant the time reference advances to the next minute.
Turning the pot will change the motor speed.
When an expansion board is present, the F1 LV Evaluation code will automatically
detect the add-on type and modify the motor drive accordingly.
DS41614A-page 20 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM
USER’S GUIDE
Chapter 3. Programming the F1 LV Evaluation Platform
3.1INTRODUCTION
The F1 LV Evaluation Platform makes extensive use of the on-board peripherals of the
PIC16LF1947. This chapter provides guidance concerning the tools used for
programming the F1 LV Evaluation Board and a map of the board function to I/O pin
and pin function.
3.2PROGRAMMING/DEVELOPMENT TOOL SUPPORT
The following development tools support the F1 LV Evaluation Platform:
1. PICkit™ 3
2. ICD 3
3. REAL ICE™ in-circuit emulator (with adapter AC164110)
The PICkit™ or ICD 3 tools can also power the F1 LV Evaluation Platform, therefore,
no additional hardware is required to get started. The ICSP pins of the PIC16LF1947
are dedicated to the PICkit ICSP connector, eliminating interactions between the
Evaluation Platform and the programmer/debugger.
If you are developing with the REAL ICE emulator ICD, you will need the AC164110
adaptor, or the high-speed trace adaptor. These adaptors provide the inline 6-pin
connector required by the PICkit ICSP programming capability interface. You will also
need a power supply, please see Chapter 2. “Getting Started” for more on powering
the F1 LV Evaluation Platform.
2011 Microchip Technology Inc.DS41614A-page 21
F1 LV Evaluation Platform User’s Guide
3.3HARDWARE RESOURCES
TABLE 3-1:HARDWARE RESOURCES
Pin NumberPORT IDI/0UseNameDescription
1RE10RE1J3 – Pin 10
2RE00RE0J3 – Pin 12
3RG00P3ALow Side Drive C; J3 – Pin 9
4RG1ILCDSEG43S1/S2/S3/S4
5RG2ILCDSEG44T1/T2/T3/T4
6RG30R3J3 – Pin 8
7RG5IMCLR/V
8RG40RG4J3 – Pin 2
9V
10NCNCPin tied to VDD
11RF7IAN5C12IN3-BEMF A; J3 – Pin 15
12RF6IAN1C1IN+BEMF Reference; J3 – Pin 16
13RF5IAN10C12IN1-BEMF C; J3 – Pin 19
14RF4IAN9C2IN+Current Sense Reference; J3 – Pin 18
15RF3IAN8C12IN2-BEMF B; J3 – Pin 17
16RF20RF2C1OUT
17RF1ILCDSEG19S5/S6/S7/S8
18RF0IAN16C12IN0-Current Sense; J3 – Pin 20
19A
20A
21RA3IAN3RA3Battery Voltage
22RA2ILCDSEG346A/6D/6E/6F
23RA1ILCDSEG185B/5C/5G/P5
24RA0ILCDSEG335A/5D/5E/5F
25V
26V
27RA5IAN4RA5Speed Control Input (New Layout)
28RA40RA4LED [D4]
29RC1IRC1T1OSCI
30RC00RC0T1OSCO
31RC60TX1Serial Transmit
32RC7IRX1Serial Receive
33RC20P1ALow Side Drive B; J3 – Pin 1
34RC3ISCK1I
35RC4ISDA1I
36RC50RC5Phase C LED, LED [D3]
37RB70RGDICSP™ Data (TestPoint 1)
38V
39RA70RA7Phase B LED; LED [D2]
40RA60RA6Phase A LED; LED [D1]
41V
42RB60PGCICSP Clock (TestPoint 1)
43RB5ILCDSEG29F2/6B/6C/6G
PPMCLR
SSSupply Return
VDDPower Supply
VSSSupply Return
SSSupply Return
DDPower Supply
2
C™ Clock
2
C Data
DDPower Supply
SSSupply Return
DS41614A-page 22 2011 Microchip Technology Inc.
Programming the F1 LV Evaluation Platform
TABLE 3-1:HARDWARE RESOURCES (CONTINUED)
44RB4ILCDSEG11F1/F3/F4/P6
45RB3ILCDSEG104B/4C/4G/P4
46RB2ILCDSEG94A/4D/4E/4F
47RB1ILCDSEG83B/3C/3G/P3
48RB0ILCDSEG303A/3D/3E/3F
49RD7ILCDSEG72B/2C/2G/P2
50RD60P1BHigh Side Drive A; J3 – Pin 3
51RD50RD5J3 – Pin 4
52RD40P3BHigh Side Drive C; J3 – Pin 11
53RD3ILCDSEG32A/2D/2E/2F
54RD2IRD2Push Button
55RD1ILCDSEG11B/1C/1G/1P
56V
57V
58RD0ILCDSEG01A/1D/1E/1F
59RE70P2ALow Side Drive B; J3 – Pin 5
60RE6ILCDCOM3COM4
61RE5ILCDCOM2COM3
62RE4ILCDCOM1COM2
63RE3ILCDCOM0COM1
64RE20P2BHigh Side Drive B; J3 – Pin 7
SSSupply Return
DDPower Supply
2011 Microchip Technology Inc.DS41614A-page 23
F1 LV Evaluation Platform User’s Guide
NOTES:
DS41614A-page 24 2011 Microchip Technology Inc.
4.1INTRODUCTION
The F1 LV Evaluation Platform demo is located at www.microchip.com/F1LVEval. The
F1 LV Evaluation demonstration program uses a single Combined Demo. The Combined Demo source code is organized into sectional code for ease of portability:
This chapter provides an overview to the functions provided by these demos.
4.2SERVICE DRIVERS
Multiple services drivers are utilized during this demo for operation. For user ease,
these drivers have been separated for easy portability.
- The I
- Using the LCD and RTCC drivers, the LCD is used for display of the clock,
- The UNI/O
2
C driver is used by the MCP9800 driver to read the current temperature
from the on-board MCP9800 I
temperature, motor status and motor type.
is being attached, and which firmware should be used.
F1 LV EVALUATION PLATFORM
USER’S GUIDE
Chapter 4. Demo Code
2
C temperature sensor.
®
driver is used to read from each add-on board which motor type
4.3COMBINED DEMO
The combined demo combines all the software from all the previous demos to show the
power of the PIC16LF1947. In this demo, the user can attach any of the (4) add-on
motor boards for use. The F1 LV Evaluation Board will auto-detect the type of motor
add-on used and automatically configure accordingly for use. All drivers are reused
from the previous demos. The RTCC is driven from the LCD peripheral.
The combined demo is preprogrammed in the F1 LV Evaluation Platform.
4.4MOTOR CONTROL GUI APPLICATION
The F1 LV Evaluation Platform is developed to connect through the MCP2200 to the
user’s computer emulating a serial port. The GUI is capable of detecting which F1 LV
add-on board is being used. Through the application, the user is capable of exploring
the many options made with these motor types.
The GUI is capable of detecting and displaying which firmware version is being used
through the F1 LV Evaluation Platform, and also which add-on board is connected. The
features of the GUI in use with the F1 LV Evaluation Platform with its add-on boards is
discussed in the Add-on User’s Guide.
4.5BLDC DEMO
The BLDC demo controls a sensorless, brushless DC motor connected to the PIC16F1
BLDC Expansion board (DM164130-2). Motors of the same type, but other than the
motor supplied, can also be driven by making appropriate modifications to the motor
control parameters.
Refer to application note AN1305, “Sensorless 3-Phase Brushless Motor Control with the PIC16FXXX”, for detailed information regarding BLDC motor control.
2011 Microchip Technology Inc.DS41614A-page 25
F1 LV Evaluation Platform User’s Guide
4.6BDC DEMO
The BDC demo controls a brushed DC motor connected to the PIC16F1 BDC
Expansion board (DM164130-6). Motors of the same type, but other than the motor
supplied, can also be driven by making appropriate modifications to the motor control
parameters.
4.7UNIPOLAR STEPPER DEMO
The Unipolar Stepper Demo controls a Unipolar stepper motor connected to the
PIC16F1 Unipolar Expansion board (DM164130-8). Motors of the same type, but
other than the motor supplied, can also be driven by making appropriate modifications
to the motor control parameters.
4.8BIPOLAR STEPPER DEMO
The Bipolar Stepper Demo controls a Unipolar stepper motor connected to the
PIC16F1 Bipolar Expansion board (DM164130-7). Motors of the same type, but other
than the motor supplied, can also be driven by making appropriate modifications to
the motor control parameters.
DS41614A-page 26 2011 Microchip Technology Inc.
Chapter 5. Hardware Libraries and Drivers
5.1INTRODUCTION
The demo code uses a common set of libraries to provide I2C, real-time clock,
MCP9800 and LCD services. These libraries may be useful for other applications so
they are documented here. These drivers are located at
5.2I2C™ DRIVER
The I2C driver allows I2C requests to be queued and then handled either by interrupts
or by polling. The driver is configured during compilation to support polling or interrupts.
2
The I
C and LCD demos configure the driver for interrupt mode. The Combined Demo
polls the I
5.3MCP9800 DRIVER
The MCP9800 driver uses the I2C driver to get the current temperature. The
mcp9800_get_temp function is fully blocking, so once a request is queued, the driver
polls the I
interrupts, the mcp9800_get_temp function repeatedly calls the I2C_handler
function to process all the I
mcp9800_get_temp function simply inserts an I2C_TRANSACTION_T into the I
transaction queue and waits for the transaction to complete.
F1 LV EVALUATION PLATFORM
USER’S GUIDE
www.microchip.com/F1LVEval
2
C handler within the MCP9800 driver.
2
C subsystem until the data is complete. If the I2C driver is operating without
2
C events. If the I2C driver is operating with interrupts, the
2
.
C
5.4RTCC DRIVER
A software RTCC is managed by the supplied RTCC driver. This driver implements the
time() function required by the C compiler. Time is internally kept as seconds since
January 1, 1970. Standard C functions can be used to convert the time to the current
date. This driver has two modes. In the first mode, it expects to be called once per
second by the Timer1 interrupt. In the second mode, it expects to be called on every
LCD mode B frame. This allows the RTCC to keep accurate time even if Timer1 is
being used by some other function, such as the BLDC motor driver.
5.5LCD DRIVER
The LCD driver contains the initialization code required for the LCD peripheral and the
mapping code required to control the LCD supplied with this demo board. It is a good
starting point for the LCD driver your unique application will require.
2011 Microchip Technology Inc.DS41614A-page 27
F1 LV Evaluation Platform User’s Guide
5.6USING THE I2C™ DRIVER
The supplied software includes an I2C Master mode driver with the following features:
1. Interrupt driven or polled
2. Queued requests
3. Minimum memory requirements
4. Uses Restart to maximize bus bandwidth
5. Multiple atomic I
6. Completion flag for each queued block of I
5.6.1I2C Data Structures
Two data structures are defined to simplify interactions with the I2C driver.
5.6.1.1I2C_RESULTS
The I2C_RESULTS is an enumerated type with the following enumerations:
TABLE 5-1:I2C_RESULTS_T
I2C_REQUEST_PENDINGRequest is in the queue or in process but it is not
I2C_REQUEST_COMPLETEThe request is finished successfully.
I2C_REQUEST_STUCK_STARTThe request was aborted. The Start condition did
I2C_REQUEST_ADDRESS_NO_ACKThe request was aborted. No ACK occurred on
I2C_REQUEST_DATA_NO_ACKThe request was aborted. Not all of the data
I2C_REQUEST_LOST_STATEThe I
The data completion flag for an I
I2C_REQUEST_PENDING until the request is complete. If the request completed
without errors, the value will be I2C_REQUEST_COMPLETE. If there were errors, the
value will reflect one of the other 4 error conditions.
2
C transactions allowed at each queue entry
2
C request is of type I2C_RESULTS. This flag will be
2
C commands.
done.
not clear correctly.
the address, so the target device must not exist
or is not functioning.
could be sent because the device did not ACK a
byte.
2
C state machine had a RAM corruption
and the default case caught the failure. This will
infinite loop so you should never see it.
5.6.1.2I2C_TRANSACTION_REQUEST_BLOCK
The I2C_TRANSACTION_REQUEST_BLOCK is a structure representing one
transaction on the I
2
C bus. A transaction contains the following elements:
1. A 7- or 10-bit address. Address type is determined automatically by the driver.
R/W mode is implicit in the address and specified by bit 0.
2. An 8-bit baud rate. This is the value placed in SPADD. Predefined constants are
included that compute the SPADD value given an FOSC value. Set FOSC with
a #define before #including the I2C.h file.
3. A buffer_length. This is the number of bytes available for reading or writing
at the supplied data buffer.
4. A Buffer Pointer. Your application will allocate a block of memory for an I
2
C
transaction. Pass a pointer to this block via the Buffer Pointer. The block must
remain valid until the transaction is complete (i.e., if you allocate the block as a
non-static array within a function, you must not leave the function until the I
2
C
transaction is complete or the array may be reused by a different function).
The function i2c_init configures the I
transaction in the transaction queue.
FIGURE 5-1:
5.6.2.2i2c_insert
The function i2c_insert places one complete set of Transaction Request Block
(TRBs). TRBs can be bundled into an array of multiple TRBs and inserted as one large
request. The driver will ensure that all the TRBs in the list will be processed sequentially
2
with I
C restarts separating them.
FIGURE 5-2:
2
C driver and makes it ready to receive
5.6.2.3i2c_build_write_trb / i2c_build_read_trb
The i2c_build_write_trb and i2c_build_read_trb functions are helpers to
assemble the I2C_TRANSACTION_REQUEST_BLOCKS from passed parameters.
FIGURE 5-3:
5.6.2.4i2c_write_block / i2c_read_block
The i2c_write_block and i2c_read_block functions are helpers that assemble
a TRB, insert it into the queue and wait for the transaction to complete.
2011 Microchip Technology Inc.DS41614A-page 29
F1 LV Evaluation Platform User’s Guide
Send_one_byte()
{
unsigned char data;
i2c_write_block(ADDRESS, 1, &data, i2c_200K);
}
Interrupt_service_routine()
{
i2c_handler();
}
typedef union
{
UINT16 val;
struct
{
unsigned digit0 : 4;
unsigned digit1 : 4;
unsigned digit2 : 4;
unsigned digit3 : 4;
};
} BCD_TYPE;
FIGURE 5-4:
5.6.2.5i2c_handler
2
The i2c_handler function must be called for each I
function can be placed into the Interrupt Service Routine for your application or, you
can simply poll it often. If the i2c_write_block or i2c_read_block functions are
used when the driver is configured for polling, then this function will repeatedly be
called until the transaction completes.
FIGURE 5-5:
5.7USING THE LCD DRIVER
C state to be handled. This
The supplied LCD driver configures the LCD module for the I/O pins used by the F1 LV
Evaluation Platform. Icon definitions are provided to simplify the software. A BCD to
7-segment display mapping function is also provided to further simplify control of the
LCD glass. For more information concerning the LCD peripheral, please consult the
LCD chapter in the PIC16LF1947 data sheet (DS41414).
5.7.1LCD Data Structures
5.7.1.1BCD_TYPE
To simplify BCD to the 7-segment display mapping, a BCD segment data type has been
provided. This data type is simply four 4-bit fields representing digits 0, 1, 2 and 3.
FIGURE 5-6:
DS41614A-page 30 2011 Microchip Technology Inc.
Simply place the number you want displayed in each digit position and call
lcd_display_digits.
Hardware Libraries and Drivers
System_initialize()
{
lcd_init();
}
void display_int(int t)
{
BCD_TYPE bcd;
bcd.digit0 = t %10;
t /= 10;
bcd.digit1 = t % 10;
t /= 10;
bcd.digit2 = t % 10;
t /= 10;
bcd.digit3 = t%10;
lcd_display_digits(bcd);
}
void update_blinking()
{
if(time(0) % 2) // if an odd number of seconds
{
lcd_display_on();
}
else
{
lcd_display_off();
}
}
5.7.2LCD Function Interface
5.7.2.1lcd_init
This function configures the LCD peripheral for this board and this glass. Type B
waveforms are used to allow the LCD peripheral to be used for the real-time clock
function. The Timer1 oscillator is configured as the LCD clock source.
FIGURE 5-7:
5.7.2.2lcd_display_digits
This function accepts a BCD_TYPE variable and maps each digit to the correct
segments. Mapping the segments is done in two stages. First, the digit is converted to
the correct 7-segment mapping. Then, the 7-segment mapping is converted to the
actual glass segments with a long series of “if-else” statements. This function will need
extensive work in the “if-else” statements for applications driving different glass.
FIGURE 5-8:
5.7.2.3lcd_display_on/lcd_display_off
These two functions simply turn the LCD peripheral off. The Timer1 oscillator is left
running. One use for these functions is to implement display blinking.
FIGURE 5-9:
2011 Microchip Technology Inc.DS41614A-page 31
F1 LV Evaluation Platform User’s Guide
void display_volts(int v)
{
display_int(v);
DP3 = 0;
DP2 = 0;
S1 = 0;
S2 = 0;
AMPS = 0;
VOLT = 1;
KILO = 0;
OHMS = 0;
if (v < 0)
MINUS = 1;
else
MINUS = 0;
}
5.7.3LCD Segment Definitions
FIGURE 5-10:LCD DISPLAY
TABLE 5-2:
PIN
12345678910111213141516
COM1
1A 1B 2A 2B 3A 3B 4A 4B F1 F2 6D PS 5D S8 S1 T1
COM2
1F 1G 2F 2G 3F 3G 4F 4G F3 6C 6E 5C 5E S7 S2 T3
COM3
1E 1C 2E 2C 3E 3C 4E 4C F4 6G 6F 5G SF S6 S3 T2
COM4
1D P1 2D P2 3D P3 4D P4 P6 6B 6A 5B 5A S5 S4 T4
There are many segments present on the F1 LV Evaluation Platform LCD. To access
these segments, simply set the supplied #defines to ‘1’ or ‘0’.
17181920
COM1
COM2
COM3
COM4
DS41614A-page 32 2011 Microchip Technology Inc.
FIGURE 5-11:
5.8USING THE RTCC DRIVER
System_initialization()
{
rtcc_init();
}
System_interrupt_service_routine()
{
If(TMR1IF & TMR1IE)
{
TMR1IF = 0;
rtcc_handler();
}
}
The RTC driver simply keeps track of seconds. The power-up initial value is ‘0’,
however, a function (rtcc_set) is provided to change that value. To keep the seconds
up-to-date, the function, rtcc_handler, must be called more frequently than the
defined value of CLOCKS_PER_SECOND. There are two options for the RTCC driver.
The first option is to use the Timer1 counter to provide a 1 Hz interrupt
(CLOCKS_PER_SECOND = 1). The second option is to use the LCD write-allowed
interrupt flag to provide a 128 Hz event (CLOCKS_PER_SECOND = 128). The two
choices are selected by defining use_lcdif or undefining use_lcdif.
5.8.1RTCC Function Interface
5.8.1.1rtcc_init
Initialize the RTCC function including Timer1, if required.
FIGURE 5-12:
Hardware Libraries and Drivers
5.8.1.2rtcc_handler
The rtcc_handler function must be called frequently to keep the internal seconds
counter accurate.
FIGURE 5-13:
5.8.1.3rtcc_set
After system initialization, the seconds counter is cleared to ‘0’. The standard C
libraries equate 0 seconds to Midnight, Jan 1, 1970. That time has expired a long time
ago, so a new time in seconds can be configured with rtcc_set().
2011 Microchip Technology Inc.DS41614A-page 33
F1 LV Evaluation Platform User’s Guide
#include <time.h>
Time_set() // set the time & date to 1 second after midnight, July 4, 2009
{
struct tm time_str;
time_t unix_time;
time_str.tm_year = 2009; // the year
time_str.tm_mon = 7; // the month
time_str.tm_mday = 4; // the day of the month
time_str.tm_hour = 0; // the hour (0-23)
time_str.tm_min = 0; // the minutes
time_str.tm_sec = 1; // the seconds
time_str.tm_isdst = -1; // daylight savings time modifier
unix_time = mktime(&time_str);
rtcc_set(unix_time);
}
System_init()
{
i2c_init();
mcp9800_init();
}
Thermostat()
{
int temperature;
temperature = mcp9800_get_temp();
if(temperature > 260)
{
turn_on_air_conditioner();
}
}
FIGURE 5-14:
5.8.1.4time
The standard C libraries require the application to supply the time function. This
function returns the current time_t value or loads a supplied time_t value. The
interrupts are saved and restored to make this function safe for use with interrupt driven
code.
5.9USING THE MCP9800 DRIVER
The MCP9800 is an I2C temperature sensor. The MCP9800 driver provides a simple
interface to the features in the sensor.
5.9.1MCP9800 Function Interface
5.9.1.1mcp9800_init
This function configures the MCP9800 for 12-bit temperature, Continuous Conversion
mode. In this mode, the temperature is always ready to be read from the I
FIGURE 5-15:
5.9.1.2mcp9800_get_temp
This function reads the current temperature and scales the result to degrees C * 10.
DS41614A-page 34 2011 Microchip Technology Inc.
(24.3C is returned 243)
FIGURE 5-16:
2
C interface.
Chapter 6. Troubleshooting
6.1INTRODUCTION
There may come a time when you need to determine why your F1 LV Evaluation
Platform is not performing correctly. This chapter lists a few of the problems that can
prevent proper operation.
6.2COMMON PROBLEMS
6.2.1The board will not power up
Make sure the power supply jumper is populating the proper pins. Confirm the ISENSE,
J4, jumper is populated or an ammeter is connected. Then, go back and review
Chapter 2. “Getting Started” of this manual.
6.2.2LCD is blank, but everything else works
The demo code in supplied with the F1 LV Evaluation Platform uses the Timer1
oscillator to drive the LCD. If the Timer1 oscillator is not oscillating, the LCD will remain
blank. Here are some steps to assure that the Timer1 oscillator is working properly.
1. Clean and dry the board especially around the components at the top right corner
of the PIC16LF1947.
2. Make sure no foreign material is shorting the crystal leads.
3. If you are using the RC0 and RC1 pins for some other function, you should
modify lcd_init to reconfigure the LCD peripheral for a different clock
source.
The Timer1 oscillator of the PIC16LF1947 is a very low-power design that can be easily
disrupted by stray leakage. In an actual application, Microchip recommends that the
crystal circuit be conformal coated to prevent leakage. Please review Application Note
AN1288, “Design Practices for Low-Power External Oscillators” for more information.
F1 LV EVALUATION PLATFORM
USER’S GUIDE
2011 Microchip Technology Inc.DS41614A-page 35
F1 LV Evaluation Platform User’s Guide
NOTES:
DS41614A-page 36 2011 Microchip Technology Inc.
7.1 INTRODUCTION
To help understand the features of the F1 LV Evaluation Platform, the schematics are
included here.