F1 Evaluation Platform for Enhanced PIC® Microcontrollers User’s Guide 2010 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 EVALUATION PLATFORM USER’S GUIDE Table of Contents Preface ........................................................................................................................... 5 Chapter 1. F1 Evaluation Platform Overview 1.1 Introduction ................................................................................................... 11 1.2 Platform Contents ......................................................................................... 11 1.3 Hardware Features ........................
F1 Evaluation Platform User’s Guide Chapter 7. Schematics 7.1 Introduction .................................................................................................. 31 Index .............................................................................................................................39 Worldwide Sales and Service .....................................................................................42 DS41401B-page 4 2010 Microchip Technology Inc.
F1 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 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 Evaluation Platform. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
F1 Evaluation Platform User’s Guide THE MICROCHIP WEB SITE Microchip provides online support via our web site at www.microchip.com. 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 Evaluation Platform User’s Guide NOTES: DS41401B-page 10 2010 Microchip Technology Inc.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 1. F1 Evaluation Platform Overview 1.1 INTRODUCTION Thank you for choosing the F1 Evaluation Platform. This kit allows you to begin development using the PIC16LF1937 microcontroller (MCU). The PIC16LF1937 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 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 PIC16LF1937 MCU using the PICkit ISCP™ header. 1.3.4 PICkit Serial Communications Header The PICkit serial is a low-cost development tool that allows I2C, SPI and USART protocols to be monitored and debugged through a simple 6-pin connector. 1.3.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 2. Getting Started 2.1 INTRODUCTION This chapter gives instruction to get your F1 Evaluation Platform powered up and running the default demonstration. The following sections include: • • • • • FIGURE 2-1: 2.
F1 Evaluation Platform User’s Guide 3. Configure the PICkit 3 to supply a voltage between 1.8 and 3.6V. For proper LCD contrast, the supply should be 3.3V. 4. Attach the PICkit 3 to the PICkit ICSP™ connector at the end of the board. 5. Activate the PICkit 3 power output. 2.4 POWERING WITH THE CONNECTOR AT JP3 To power with the connector at JP3, perform the following steps: 1. Make sure a jumper or an ammeter is connected across JP2. 2. If you are using a BLDC expansion, remove the jumper at JP1. 3.
Getting Started 2.6 POWERING WITH THE BLDC EXPANSION HEADER J3 The BLDC Expansion hardware contains a 3.3V linear regulator. This allows the 5-12V motor power supply to power the PIC16LF1937. J3 pin 6 is the source for the 3.3V power. To use this power perform the following steps. 1. 2. 3. 4. 5. 6. 2.7 Make sure a jumper or an ammeter is connected across JP2. Insert the shorting jumper at JP1. Verify that any attached PICkit 3 or PICkit serial is not supplying power.
F1 Evaluation Platform User’s Guide 2.7.4 LCD Display The time, temperature, pot position and motor speed are displayed on the LCD. The LCD is a 3.5-digit multimeter display with icons for amps, volts, ohms, etc. The display uses 4 commons and 10 segment drives. The Timer1 oscillator is used to clock the display peripheral and allow the LCD to display data even in Sleep. The LCD peripheral was configured for a Type B waveform for this demo. This mode provides an interrupt when the LCD can be updated.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 3. Programming the F1 Evaluation Platform 3.1 INTRODUCTION The F1 Evaluation Platform makes extensive use of the onboard peripherals of the PIC16LF1937. This chapter provides guidance concerning the tools used for programming the F1 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 Evaluation Platform: 1. PICkit™ 3 2. PICkit™ 2 3.
F1 Evaluation Platform User’s Guide 3.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 4. Demo Code 4.1 INTRODUCTION The F1 Evaluation Platform demos are located at www.microchip.com/F1Eval. The following demos are available: 1. 2. 3. 4. I2C™ Demo LCD Demo BLDC Demo Combined Demo This chapter provides an overview to the functions provided by these demos. 4.2 I2C™ DEMO The I2C demo reads the current temperature from the on-board MCP9800 I2C temperature sensor. The I2C driver is used to extract the data.
F1 Evaluation Platform User’s Guide NOTES: DS41401B-page 20 2010 Microchip Technology Inc.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 5. Hardware Libraries and Drivers 5.1 INTRODUCTION All of 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/F1Eval. 5.2 I2C™ DRIVER The I2C driver allows I2C requests to be queued and then handled either by interrupts or by polling.
F1 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(I2C_400K); } 5.6.2.2 i2c_insert The function i2c_insert places one complete set of Transaction Request Block (TRB’s). TRBs can be bundled into an array of multiple TRBs and inserted as one large request.
F1 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 Evaluation Platform User’s Guide 5.7.3 LCD Segment Definitions FIGURE 5-10: LCD DISPLAY There are many segments present on the F1 Evaluation Platform LCD. To access these segments, simply set the supplied #defines to ‘1’ or ‘0’. FIGURE 5-11: 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.8 USING THE RTCC DRIVER The RTC driver simply keeps track of seconds.
Hardware Libraries and Drivers FIGURE 5-12: System_initialization() { rtcc_init(); } 5.8.1.2 rtcc_handler The rtcc_handler function must be called frequently to keep the internal seconds counter accurate. FIGURE 5-13: System_interrupt_service_routine() { If(TMR1IF & TMR1IE) { TMR1IF = 0; rtcc_handler(); } } 5.8.1.3 rtcc_set After system initialization, the seconds counter is cleared to ‘0’. The standard C libraries equate 0 seconds to Midnight, Jan 1, 1970.
F1 Evaluation Platform User’s Guide 5.9.1 MCP9800 Function Interface 5.9.1.1 mcp9800_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 I2C interface. FIGURE 5-15: System_init() { i2c_init(); mcp9800_init(); } 5.9.1.2 mcp9800_get_temp This function reads the current temperature and scales the result to degrees C * 10. (24.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 6. Troubleshooting 6.1 INTRODUCTION There may come a time when you need to determine why your F1 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 there is no shorting jumper at JP3. Then, go back and review Chapter 2. “Getting Started” of this manual. 6.2.
F1 Evaluation Platform User’s Guide NOTES: DS41401B-page 30 2010 Microchip Technology Inc.
F1 EVALUATION PLATFORM USER’S GUIDE Chapter 7. Schematics 7.1 INTRODUCTION To help understand the features of the F1 Evaluation Platform and the BLDC add-on board, the schematics are included here. 2010 Microchip Technology Inc.
F1 Evaluation Platform User’s Guide F1 Evaluation Platform Schematic (1 of 3) 7.1.1 DS41401B-page 32 2010 Microchip Technology Inc.
Schematics 7.1.2 F1 Evaluation Platform Schematic (2 of 3) 2010 Microchip Technology Inc.
F1 Evaluation Platform User’s Guide 7.1.3 F1 Evaluation Platform Schematic (3 of 3) DS41401B-page 34 2010 Microchip Technology Inc.
Schematics 7.1.4 BLDC Add-On Schematic (1 of 3) 2010 Microchip Technology Inc.
F1 Evaluation Platform User’s Guide 7.1.5 BLDC Add-On Schematic (2 of 3) DS41401B-page 36 2010 Microchip Technology Inc.
Schematics 7.1.6 BLDC Add-On Schematic (3 of 3) 2010 Microchip Technology Inc.
F1 Evaluation Platform User’s Guide NOTES: DS41401B-page 38 2010 Microchip Technology Inc.
F1 EVALUATION PLATFORM USER’S GUIDE Index Numerics I 2C Demo .................................................................. 19 3.5-digit LCD ............................................................ 12 ICSP pins ................................................................. 17 Internet Address......................................................... 8 A L AC164110 ................................................................ 17 Ammeter .....................................................
F1 Evaluation Platform User’s Guide R RD1 .......................................................................... 18 RD2 .......................................................................... 18 RE0 .......................................................................... 18 RE1 .......................................................................... 18 RE2 .......................................................................... 18 Reading, Recommended............................................
F1 Evaluation Platform User’s Guide NOTES: 2010 Microchip Technology Inc.
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://support.microchip.com Web Address: www.microchip.