Please share your suggestions, comments, and criticisms in the box below. Every message is read and receives a response. Thank you for taking time to improve the tool!
The goal of this example is to provide 11 labs that will demonstrate Explorer 8 board capabilities and showcase the functionality of PIC18F25K22 device. The concept is to create a state machine where you can navigate through each lab by pressing the S2 button. Another button(S1) is used to execute labs requiring external stimulus. The output of labs is shown using three LEDs and an LCD provided by the Explorer 8 development board. Some labs need a potentiometer for Analog input. This project is primarily created with the aim of helping beginners in basic programming of MCUs.
This example also make use of the latest MPLAB Code Configurator (MCC v3.75), an easy-to-use plugin tool for MPLAB X IDE(v5.20) that you can use to generate codes for a more efficient use of the CPU and memory resources. All labs are written in C language and are compatible with the latest XC8 compiler (XC8 v2.05).
a.MPLAB X IDE (http://www.microchip.com/mplab/mplab-x-ide)
b. MPLAB X Code Configurator (http://www.microchip.com/mplab/mplab-code-configurator)
c. XC8 Compilers (http://www.microchip.com/mplab/compilers)
MPLAB Code Configurator (MCC) is used to configure the system setup for the PIC18F25K22. The external clock is used for oscillator and then set to 8 MHz. The watchdog timer is set through SWDTEN with a period of approximately eight seconds.
This lab shows how to configure, initialize and turn on an I/O (LED_D8) pin while the LCD displays “Hello World” and “LED_D8 = ON” on the first and second line respectively.
This lab shows how to create a blinking LED using Timer1. LED_D8, which is OFF at its initial state, toggles every 1.5 seconds creating a blinking sequence. The LCD displays “Blink” on the first line while displaying “LED_D8 = OFF” and “LED_D8 = ON” alternately every 1.5 seconds on the second line. The Timer1 module is used for accurate timing.
LEDs D6, D7 and D8 light up in turn every 500 milliseconds software delay. Once D8 is lit, D6 lights up and the pattern repeats. The LCD displays “Rotate” on the first line and “LED_Dx = ON” on the second line, where x indicates which LED is currently lit.
This lab shows how to configure the ADC, run a conversion, read the analog voltage controlled by the on-board potentiometer, and display the high order three bits on the LEDs. The LCD displays “ADC” on the first line and “ADC Result = x” on the second line where x shows the current ADC conversion result from 0 (0b000) to 7(0b111).
This lesson combines all the previous lessons to produce a variable speed rotating LED display. The LEDs rotates from left to right. The Speed of the rotation depends on the ADC value provided by the potentiometer. The LCD displays “VSR” on the first line and “Delay = xxx ms” on the second line, where xxx indicates the time interval between LED shifts.
LEDs D6, D7 and D8 light up in turn every S1 button press. Once D8 is lit and S1 is pressed, D6 lights up and the pattern repeats. Holding the button moves the light continuously across the LEDs. The LCD displays “Debounce” on the first line and “LED_Dx = ON” on the second line, where x indicates which LED is currently lit.
In this lab, rotating the potentiometer changes the light intensity of LED_D8. The value of the ADC provided by the potentiometer changes the value of the duty cycle which determines the brightness of the LED. The LCD displays “PWM” on the first line and “Duty Cycle = xx%” on the second line, where xx corresponds to the PWM duty cycle.
This lab produces the same output as rotate lab the only difference is that it uses Timer1 instead of software delay function. The LCD displays “TIMER1” on the first line and “Time = xxx secs” on the second line where xxx indicates a value between 0 and 100 corresponding to the time since TIMER1 started incrementing. A 1-second increment is equivalent to two LED shifts. When the display reaches 100, it will reset to 0 and the counting goes on.
Light on LEDs D6, D7 and D8 shift at a constant speed and pressing switch S1 reverses the direction of rotation. The LCD displays “Interrupt” on the first line and “Direction = x” on the second line, where x can either be “Left” or “Right” depending upon the direction of rotation. Interrupts signal events that require servicing by the software’s Interrupt Service Routine(ISR). It is a more efficient way of watching out for events than continuously polling a register.
This lab introduces the Sleep mode function which puts the device into a low power standby mode. Upon entering this lab, a countdown timer will be displayed on the LCD while LED_D7 is ON and LEDs D6/D8 are OFF and the device will be put into Sleep after 5 seconds. The device will then wake up after 8 seconds, toggling the state of LEDs and the LCD will display “I’m now awake!” on the second line.
In this lab, the top 3 converted MSB value of the ADC from the potentiometer input is written on the EEPROM whenever S1 button is pressed. The value written on the EEPROM is then read and displayed on the LEDs D6-D8. The LCD displays “EEPROM” on the first line and “Value = x” on the second line, where x corresponds to the saved ADC result in the EEPROM.
Note: For the complete step by step guide in making this example, click here and open the Read Me document inside the downloaded folder.
MPLAB Xpress IDE shall mean the online integrated development environment (hereinafter “MPLAB Xpress”) operated by or on behalf of Microchip Technology Incorporated (hereinafter "Microchip") for your use, whether as a guest or a registered user. Microchip is a Delaware corporation with its principal office at 2355 W. Chandler Boulevard, Chandler, AZ 85224.
Access to MPLAB Xpress is permitted on a temporary basis, and Microchip reserves the right to withdraw or amend the information provided on MPLAB Xpress without notice. Microchip will not be liable if for any reason MPLAB Xpress is unavailable at any time or for any period. From time to time, Microchip may restrict access to some or all of MPLAB Xpress.
Material on MPLAB Xpress may be out of date or include omissions, inaccuracies or other errors at any given time, and Microchip is under no obligation to update such material. Commentary and other materials posted on MPLAB Xpress are not intended to amount to advice on which reliance should be placed. Microchip disclaims all liability and responsibility arising from any reliance placed on such materials by any user of MPLAB Xpress, or by anyone who may be informed of any of its contents. Microchip owns or has the rights to the materials and information it posts on MPBLAB Xpress, but does not and cannot warrant or guaranty any information or materials posted by others.
EXCEPT WHERE EXPRESSLY PROVIDED OTHERWISE IN AN AGREEMENT BETWEEN YOU AND MICROCHIP, ALL INFORMATION PROVIDED DIRECTLY ON MPLAB XPRESS OR INDIRECTLY THROUGH MPLAB XPRESS BY HYPERTEXT LINK OR OTHERWISE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROCHIP HEREBY DISCLAIMS ALL WARRANTIES WITH RESPECT TO THIS INFORMATION, WHETHER EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM YOUR ACCESS TO, USE OF, OR RELIANCE UPON INFORMATION OBTAINED FROM OR THROUGH MPLAB XPRESS. MICROCHIP RESERVES THE RIGHT TO MAKE CHANGES, UPDATES OR CORRECTIONS TO THE INFORMATION ON MPLAB XPRESS AT ANY TIME WITHOUT NOTICE.
Contracts for the supply of goods, services or information formed through the use of the MPLAB Xpress site or as a result of visits made by you to the MPLAB Xpress site are governed by these terms and conditions.
MPLAB Xpress may contain links to other sites and resources provided by third parties. Any such links are provided for your information only. Microchip has no control over the contents of those sites or resources, and accepts no responsibility for them or for any loss or damage that may arise from your use of them.
How is Customer Information Obtained by Microchip and How is it Used?
We receive and store information you give us, anonymously. Most of the information you give us is collected when you buy products on-line, request literature/ information, participate in a contest, fill out a questionnaire/survey, participate in an on-line discussion, or complete your Customer Profile. You may give us information such as your name, address, phone numbers, e-mail addresses, financial information, employment information, application information, ideas for new projects or applications, and your buying interests. The information that you provide us is used to respond to your requests, notify you of products being shipped to you, customize your interactions with us, improve our offerings, provide materials or offers to you, allow you to participate in contests, and communicate with you. It is your choice whether or not to provide us with certain information. However, you may be unable to take advantage of many of our offers and features if we do not receive your customer information.
We also receive and store certain types of information through use of “cookies.” Some examples of information gathered this way are the Internet Protocol (IP) address used to connect your computer to the Internet, log-in, e-mail address, computer and connection information such as browser type and version, operating system, platform, and the full Uniform Resource Locator (URL) used to, through, and from access of MPLAB Xpress. We use the information gathered by “cookies” to manage and customize your on-line experience and to improve our services.
You may also submit technical information to Microchip such as designs, ideas or data, that you transmit to or post on MPLAB Xpress example section (a "Submission") for purposes not limited to community development participation. By posting a Submission, you understand that you give Microchip and the community a nonexclusive, royalty-free, perpetual, irrevocable, sublicensable right to disseminate, display, use, modify, copy, adapt, and translate the Submission for any purpose whatsoever, whether commercial or noncommercial, throughout the world in any media. The Submission is not confidential or proprietary. Providing the Submission, grants the right to use the name you submit in connection with your Submission. You represent and warrant in making the Submission that you own or control all rights to the Submission, and that use of your Submission will not cause injury to any person or entity, including Microchip. You will indemnify Microchip for all claims resulting from your Submission.
How can I manage the information Microchip has about me?
You can always choose not to give Microchip information. However, certain information is necessary in order for you to take advantage of MPLAB Xpress, any change notifications, literature, updates, etc.
If you want to add/update your information or preferences, please modify your MPLAB Xpress account profile. When you update your information, we may keep a copy of your earlier information for our records.
You can avoid certain "cookies" by indicating in your account profile that you do not want us to remember you. Your browser may also have options to prevent acceptance of new “cookies.” There are also utilities available allowing you to visit MPLAB Xpress anonymously. Unfortunately, certain features and offerings available through MPLAB XPress may not be available to anonymous users.
Who does Microchip share Customer Information With?
Customer information is important for Microchip to be able to offer products and services to you. We are not in the business of selling customer information to others. We do share customer information with our subsidiaries and with others as described below. Such third parties may be based in the United States, Europe or Thailand. We are not responsible for the privacy practices of third parties to whom your information may be transferred. If you do not wish us to share your information as described below, you may opt out by not supplying information to us when entering information into your account profile, or by not placing orders through MPLAB Xpress.
Agents: We use other companies and persons to perform tasks on our behalf. Examples are not limited to web hosting of MPLAB Xpress, delivering packages, processing credit card payments, checking for export compliance, and providing customer service. They have access to customer information to perform their jobs, but may not use it for other purposes. Microchip may share your customer information with third parties and receive information from credit bureaus and other companies to help prevent and detect fraud, and to offer credit or financial services to some customers. Microchip cannot guaranty the security of such agent services provided on its behalf. As such, Microchip makes no representations or warranties regarding any third party services and has no responsibility or liability whatsoever for any such third party services and is not responsible for the content or privacy practices of such third parties
Third Parties: Except for information transmitted to Microchip through the on-line support system at http://support.microchip.com, any other Submission to Microchip such as designs, ideas or data that you transmit to or post on MPLAB Xpress by any means for any purpose including but not limited to contest participation is considered and treated by Microchip as nonconfidential and nonproprietary.
Conformance with the Law: We release account and other customer information when we believe it is appropriate to comply with the laws of Arizona.
Protection of Microchip and Others: Microchip will release customer information necessary to enforce or apply our MPLAB Xpress IDE Terms and Conditions, and other agreements. Microchip will, at its discretion, release customer information necessary to protect the rights, property and safety of Microchip or others in accordance with the laws of Arizona.
We use 256-bit encryption to secure the financial information you enter. Only the last five digits of your credit card number are listed in your Order Acknowledgement. However, your entire credit card number is transmitted to your credit card company during order processing, and your identifying and credit information is transmitted to companies that process your credit card transactions and review them for export control violations.
Law and Jurisdiction
If you have any concern about our treatment of your customer information, please send us an e-mail at email@example.com.