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 objective of this example is to demonstrate how to get started with the Real Time Clock & Calendar Module that is found on the PIC16(L)F191xx family of devices using MCC.
This project will show how to configure the time and calendar settings of the RTCC module, and will configure a basic alarm. The PIC16F19176 was used for this example. LED D2 blinks every every time the SECONDS value within the RTCC module changes, and LED D5 will blink whenever an alarm condition is met. In addition to LED D5 blinking with every alarm condition, an audible tone will be played using the Piezo Buzzer Click Board.
The development board used for this example was the Curiosity HPC Development Board. The MikroElektronika Buzz Click board was also used to provide an audible tone for the alarm conditions generated by the RTCC module. The hardware used for the USB to EUSART serial conversion was the Microchip MCP2200 Breakout Module. The RTCC module clock source in this example was configured to be the SOSC module, and the Citizen CFS-206 32.768kHz crystal was tied to the SOSCI and SOSCO pins along with two 10 pF capacitors (as seen in the screen shot below).
The RTCC module is an integrated 100-year clock and calendar with automatic leap year detection and correction. The range of the clock is from 00:00:00 (midnight) on January 1st, 2000 to 23:59:59 on December 31st, 2099. The RTCC module uses the 24-hour time format (military time). It offers VBAT battery backup to allow the RTCC and SOSC modules to continue running from an external power supply (battery or supercapacitor) in the event of a VDD failure.
The RTCC module was initialized with the current time in this example within the MCC generate initialization routine, and the RTCC alarm was configured to repeat every 10 seconds. The RTCC clock source was configured as the secondary oscillator (SOSC), and an interrupt service routine was created to blink an LED and sound the Piezo Buzzer whenever an alarm condition is detected (RTCCIF = 1). Below are the key registers used when configuring the RTCC module on the PIC16F19176.
The RTCC module was added into this example using MCCr. The screenshot below shows the configuration settings used for this module.
The PIC16(L)F191xx family of devices allow the user to utilize a "VBAT" pin that enables the user to connect an external battery or power supply. This can help ensure that the SOSC and RTCC modules continue running in the event of a VDD power supply failure, and that the RTCC data is not lost. The VBAT pin on this device is located on RA5. Battery backup functionality is enabled by setting the VBATEN bit of Configuration Word 1 (VBATEN = ON).
The MikroElektronika Buzz Click board that was used in this example is driven using a PWM signal, with the tone and volume dependent on frequency and duty cycle. The PWM4 and TIMER2 modules were both added to this project using MCC so that we could drive the Buzz Click board to produce an audible tone with each alarm event from the RTCC module. The screenshot below shows the configuration settings that were used within MCC. Please note that the duty cycle for the PWM output signal was initiazlied to be 0%, and will be updated within the RTCC interrupt service routine as the RTCC alarm is triggered.
The EUSART module is implemented in this example to display the current time and date information from the RTCC module. In addition to continually updating with the current time and date information via serial port, a message will be sent via serial port to the PC whenever an alarm condition has been triggered. The USART2 module was added into the project using MCC. The screenshot below shows the configuration settings used for this module in MCC.
The screenshot below shows the pin assignments / PPS settings that were configured in MCC using the Pin Manager View for each respective module in this example.
This example demonstrates how to use the RTCC module to keep accurate track of time and date in an application. It also demonstrates how to initialize and use the alarm feature, and is configured to drive the MikroElektronika Buzz Click to play an audible alarm tone every 10 seconds. In addition to the alarm tone, LED D5 on the Curiosity HPC Development Board will also light up whenever an alarm is detected. The code that handles the alarm event can be found in the RTCC ISR function in the "rtcc.c" file of the project.
The EUSART module was used in this example to display the RTCC time and date information from a PC. The RTCC information is sent to the PC via serial port and updated every second. Whenever an alarm event is detected the code will jump into the RTCC Interrupt Service Routine, and a message will be sent to the PC via serial port that signifies an alarm condition has been detected. The screenshot below shows an example of what the EUSART output should look like on your PC.
For more information about the PIC16F19176, or the Real Time Clock and Calendar Module, please refer to the device datasheet linked at the bottom of this example. In addition to the datasheet, refer to the RTCC + VBAT Technical Brief for more information. Comment below with any questions!
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 firstname.lastname@example.org.