Well, okay, without further ado, I took the time these days to write based on the previous blog, and added some things to make a real-time clock. Of course, the functions are not complete yet, there is no function to adjust the time, no timing function, and there is no function to add a menu on LCD12864... Anyway, this is the simplest real-time clock. The main purpose is to learn about the RTC inside LPC2134. Although the program can run, there is a small BUG during simulation, that is, the second value is updated only once every 3 seconds, which makes the lazy cat very depressed. I have been searching for the reason for a long time but have not found it. However, the lazy cat did not give up and kept looking until it was eliminated. If you have written a program in this area, you can also guide the lazy cat. The lazy cat will be very grateful. Thank you very much.
OK, here is the interface diagram for this simulation. I would like to emphasize that this is only used for simulation in Proteus and cannot be used for actual welding:
Figure 1-1
Since this real-time clock is modified based on the previous log "LPC2134 Learning Log
//File name: Clock.h
//
//
//
//
//
//
#ifndef __CLOCK_H__
#define __CLOCK_H__
#include "config.h"
#define RTC_NUM 13
#define T0_NUM 4
struct {
#define Cur_Sec
#define Cur_Min
#define Cur_Hour
#define Cur_Year
#define Cur_Month current_time.month
#define Cur_Day
#define Cur_Week
#define Pre_Sec
#define Pre_Min
#define Pre_Hour
#define Pre_Year
#define Pre_Month pre_time.month
#define Pre_Day
#define Pre_Week
struct {
#define Timet
#define Datet
BOOL t0flag;
BOOL secflag;
BOOL dotflag;
extern void RTC_Init(void);
extern void Timer0_Init(void); //
extern void T0_Process(void);
extern void Updata_Time(void); //
#endif
This file mainly declares some global variables and some functions related to writing RTC and timer, among which BOOL
This data type is customized by me and is declared as follows in config.h:
//Define binary variables using union
typedef enum
{
} BOOL;
The following functions are called in the main function, so the keyword extern must be added. I will not post the contents of the Clock.c file here, as it is a bit long. If you are interested, you can refer to the attachment, which contains source code and project files. The compilation environment is MDK4.12. Here I would also like to talk about the Show_Time (uint8 svalue, uint vposi) function. This function is used to display the corresponding position on the LCD after updating the data. One thing to note is that you must clear that position to 0 before redisplaying, otherwise garbled characters will appear. As shown in the following program:
void Show_Time(uint8 svalue,uint8 vposi)
{
}
OK, that's all I have to summarize for now. It's time to get back to work. Otherwise, my boss might think I'm playing around again. I'll check for bugs when I get home tonight.
Previous article:S3C6410 bare metal timer
Next article:LPC2134 Learning Log -- LCD12864 Learning
Recommended ReadingLatest update time:2024-11-16 20:46
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Zigbee (CC2530) connected to esp8266 can only send but not receive
- Mini RP2040 development board minik
- Analysis of the Design Method of DSP and Slow Peripheral Device Interface
- 【LuatOS-ESP32】Download tool——Luatoose installation and use
- [ST60 short-distance evaluation] Part 1: First release on the Internet! Detailed evaluation!
- How reliable is Dupont wire???
- Q and D values of capacitors
- TI CC3200 WIFI Training Development Kit——by light-s
- HDMI to MIPI universal driver horizontal screen 1080P HD PC Raspberry Pi projector set-top box PS4 camera sub-screen side-transparent monitor TF card
- FPGA-based RGB to YUV422 digital video conversion.pdf