F1 LV Evaluation Platform for Enhanced PIC® Microcontrollers User’s Guide 2011 Microchip Technology Inc.
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.
F1 LV EVALUATION PLATFORM USER’S GUIDE Table of Contents Chapter 1. F1 LV Evaluation Platform Overview 1.1 1.2 1.3 Introduction ............................................................................................. 11 Platform Contents ................................................................................... 11 Hardware Features ................................................................................. 11 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.3.10 1.3.11 1.3.
F1 LV Evaluation Platform User’s Guide 4.5 4.6 4.7 4.8 BLDC Demo ........................................................................................... 25 BDC Demo ............................................................................................. 26 Unipolar Stepper Demo .......................................................................... 26 Bipolar Stepper Demo ............................................................................ 26 Chapter 5.
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.
F1 LV Evaluation Platform User’s Guide CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Arial font: Italic characters Initial caps Quotes Underlined, italic text with right angle bracket Bold characters N‘Rnnnn Text in angle brackets < > Courier New font: Plain Courier New Represents Referenced books Emphasized text A window A dialog A menu selection A field name in a window or dialog A menu path MPLAB® IDE User’s Guide ...
Preface 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.
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.
Preface 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.
F1 LV Evaluation Platform User’s Guide NOTES: DS41614A-page 10 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 1. F1 LV Evaluation Platform Overview 1.1 INTRODUCTION 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.
F1 LV Evaluation Platform User’s Guide 1.3.3 PICkit™ 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.4 MCP2200 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.
F1 LV Evaluation Platform Overview 1.3.12 User 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.
F1 LV Evaluation Platform User’s Guide NOTES: DS41614A-page 14 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 2. Getting Started 2.1 INTRODUCTION 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: 2011 Microchip Technology Inc.
F1 LV Evaluation Platform User’s Guide 2.2 POWERING 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. 3. 4. 5. 2.3 External Power Source, J5 Use the Add-on Expansion Header, J6 Use an AAA Battery, J7, or Use USB Cable, J8.
Getting Started 2.4 POWERING 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 VREF+ to EXT SUPP (+), connect VREF- to EXT SUPP(-). 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: 2011 Microchip Technology Inc.
F1 LV Evaluation Platform User’s Guide 2.5 POWERING 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. 2. 3. 4. 5. Make sure a jumper or an ammeter is connected across J4. Verify that any attached PICkit 3 is not supplying power.
Getting Started 2.7 POWERING 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: 2.8 USB POWER DEFAULT FIRMWARE The default firmware supplied with your F1 LV Evaluation Board Demo performs the following functions: 1. Blink LEDs 2.
F1 LV Evaluation Platform User’s Guide 2.8.3 Add-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 BDC Unipolar Stepper Bipolar Stepper 2.8.
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 3. Programming the F1 LV Evaluation Platform 3.1 INTRODUCTION 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.2 PROGRAMMING/DEVELOPMENT TOOL SUPPORT The following development tools support the F1 LV Evaluation Platform: 1. PICkit™ 3 2. ICD 3 3.
F1 LV Evaluation Platform User’s Guide 3.
Programming the F1 LV Evaluation Platform TABLE 3-1: 44 HARDWARE RESOURCES (CONTINUED) RB4 I LCD SEG11 F1/F3/F4/P6 45 RB3 I LCD SEG10 4B/4C/4G/P4 46 RB2 I LCD SEG9 4A/4D/4E/4F 47 RB1 I LCD SEG8 3B/3C/3G/P3 48 RB0 I LCD SEG30 3A/3D/3E/3F 49 RD7 I LCD SEG7 2B/2C/2G/P2 50 RD6 0 P1B High Side Drive A; J3 – Pin 3 51 RD5 0 RD5 J3 – Pin 4 52 RD4 0 P3B High Side Drive C; J3 – Pin 11 53 RD3 I SEG3 2A/2D/2E/2F 54 RD2 I RD2 Push Button 55 RD1 I LCD LCD 5
F1 LV Evaluation Platform User’s Guide NOTES: DS41614A-page 24 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 4. Demo Code 4.1 INTRODUCTION 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.2 SERVICE DRIVERS Multiple services drivers are utilized during this demo for operation.
F1 LV Evaluation Platform User’s Guide 4.6 BDC 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.7 UNIPOLAR STEPPER DEMO The Unipolar Stepper Demo controls a Unipolar stepper motor connected to the PIC16F1 Unipolar Expansion board (DM164130-8).
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 5. Hardware Libraries and Drivers 5.1 INTRODUCTION 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 www.microchip.com/F1LVEval. 5.2 I2C™ DRIVER The I2C driver allows I2C requests to be queued and then handled either by interrupts or by polling.
F1 LV Evaluation Platform User’s Guide 5.6 USING THE I2C™ DRIVER The supplied software includes an I2C Master mode driver with the following features: 1. 2. 3. 4. 5. 6. Interrupt driven or polled Queued requests Minimum memory requirements Uses Restart to maximize bus bandwidth Multiple atomic I2C transactions allowed at each queue entry Completion flag for each queued block of I2C commands. 5.6.1 I2C Data Structures Two data structures are defined to simplify interactions with the I2C driver. 5.6.1.
Hardware Libraries and Drivers 5.6.2 I2C Function Interface 5.6.2.1 i2c_init The function i2c_init configures the I2C driver and makes it ready to receive transaction in the transaction queue. FIGURE 5-1: initialize() { i2c_init; } 5.6.2.2 i2c_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.
F1 LV Evaluation Platform User’s Guide FIGURE 5-4: Send_one_byte() { unsigned char data; i2c_write_block(ADDRESS, 1, &data, i2c_200K); } 5.6.2.5 i2c_handler The i2c_handler function must be called for each I2C state to be handled. This function can be placed into the Interrupt Service Routine for your application or, you can simply poll it often.
Hardware Libraries and Drivers 5.7.2 LCD Function Interface 5.7.2.1 lcd_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: System_initialize() { lcd_init(); } 5.7.2.2 lcd_display_digits This function accepts a BCD_TYPE variable and maps each digit to the correct segments.
F1 LV Evaluation Platform User’s Guide 5.7.3 LCD Segment Definitions FIGURE 5-10: LCD DISPLAY TABLE 5-2: PIN COM1 1 2 3 4 5 6 7 8 9 1A 1B 2A 2B 3A 3B 4A 4B F1 10 11 12 13 14 15 F2 6D PS 5D S8 S1 16 17 18 19 20 T1 COM1 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 COM2 COM3 COM4 There are many segments present on the F1 LV Evaluation Platform LCD.
Hardware Libraries and Drivers 5.8 USING THE RTCC DRIVER 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).
F1 LV Evaluation Platform User’s Guide FIGURE 5-14: #include 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.
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 6. Troubleshooting 6.1 INTRODUCTION 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.2 COMMON PROBLEMS 6.2.1 The 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.
F1 LV Evaluation Platform User’s Guide NOTES: DS41614A-page 36 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM USER’S GUIDE Chapter 7. Schematics 7.1 INTRODUCTION To help understand the features of the F1 LV Evaluation Platform, the schematics are included here. 2011 Microchip Technology Inc.
F1 LV Evaluation Platform User’s Guide 7.1.1 F1 LV Evaluation Platform Schematic (1 of 4) DS41614A-page 38 2011 Microchip Technology Inc.
Schematics 7.1.2 F1 LV Evaluation Platform Schematic (2 of 4) 2011 Microchip Technology Inc.
F1 LV Evaluation Platform User’s Guide 7.1.3 F1 LV Evaluation Platform Schematic (3 of 4) DS41614A-page 40 2011 Microchip Technology Inc.
Schematics 7.1.4 F1 LV Evaluation Platform Schematic (4 of 4) 2011 Microchip Technology Inc.
F1 LV Evaluation Platform User’s Guide NOTES: DS41614A-page 42 2011 Microchip Technology Inc.
F1 LV EVALUATION PLATFORM USER’S GUIDE Index A P AC164110 ................................................................ 21 Ammeter .................................................................. 19 Documentation Conventions ........................................................ 6 Layout ................................................................. 5 PIC® microcontrollers .............................................. 11 PIC16 series............................................................
Worldwide Sales and Service AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://www.microchip.com/ support Web Address: www.microchip.