Hi Doug Mclean,
Are you getting a 1Hz pulse from GPS module? If so, then there is one way you can use RTC.
I haven't tried this method yet, but it may be implemented in the following way.
1) Use a PICU interrupt and set it to Rising edge. This pin will be connected to the 1Hz signal from the GPS module.
2) The CY_ISR(RTC_ISR) which is available in the RTC_INT.c file (assuming the name of the RTC component used is 'RTC') is placed in the executable part of the ISR of the PICU.
3) There is no need of using an RTC component in this project as only PICU will take care of the all the parameters.
4) The RTC component available in PSoC Creator is a software implementation which uses 1pps clock from the 32.768KHz crystal. Hence, this can be implemented in software.
Wow, that is absolutely perfect, thank you very much.
Except that I do need to have an RTC component so that the RTC code will be generated, right?
Will anything go wrong if I add the component, copy the code into a different place, remove the component and call the copy?
Are you using the Alarm feature available in the RTC component?
Hi Doug McClean,
There is another rather simple way to do this.
1) You can place an RTC Component and configure it in accordance with your requirement.
2) Now place a digital input pin and connect it to an Interrupt Component. This Pin must be connected to the 1 Hz Pulse from GPS.
3) In the main( ) function, initialize all the parameters of RTC such as sec, min, hour, date, etc But donot start the RTC Component.
4) In the CY_ISR of Interrupt, call the RTC_ISR( ) function which is found in the RTC_INT.c file.
Now the project will perform all the functions of the RTC except for the fact that the interrupt source is not the PPS from external 32.768KHz but is from an external 1Hz clock (which in this case is received from the GPS module).
This method is better than the previous method suggested as there is no possibility of encountering any error which may arise due to incorrect copying of the APIs and header files of the RTC component to the Pin Interrupt's ISR file.
A sample project was constructed and for testing purpose a 1Hz clock was brought out from a pin. The digital input pin and the clock output pins were externally connected using a wire.
The schematic is as shown below.
In the isr_1.c, the RTC_ISR( ) is called. This is shown in the snap-shot given below:
The project has been attached along with this post.
RTC_trial.zip 249.9 K
Brilliant! This is just what I needed.