Đồng hồ kỹ thuật số sử dụng vi điều khiển 8 051

27 110 0
Đồng hồ kỹ thuật số sử dụng vi điều khiển 8 051

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Đồn g h ồk ỹthu ật s ốs ửd ụng vi ều ển 8.051 B ởi Saddam Nh ận xét Đồng hồ kỹ thuật số sử dụng vi điều khiển 8.051 Trong dự án này, s ẽ chứng minh vi ệc tạo m ột đồng hồ RTC sử d ụng vi ều khiển 8051 Nếu b ạn mu ốn làm d ự án v ới Arduino, ki ểm tra đồng hồ số b ằng Arduino Thành phần dự án DS1307 IC đồng h th ời gian thực Cho phép biết chi tiết IC RTC DS1307 : The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM This chip works on I²C protocol The clock/calendar provides seconds, minutes, hours, day, date, month, and year information The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year The clock operates in either the 24hour or 12-hour format with AM/PM indicator The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply Timekeeping operation continues while the part operates from the backup supply DS1307 chip can continuously run till 10 year 8051 based Real time clock is a digital clock to display real time using a RTC DS1307, which works on I2C protocol Real time clock means it runs even after power failure When power is reconnected, it displays the real time irrespective to the time and duration it was in off state In this project we have used a 16x2 LCD module to display the time in - (hour, minute, seconds, date, month and year) format Real time clocks are commonly used in our computers, houses, offices and electronics device for keeping them updated with real time I2C protocol is a method to connect two or more devices using two wires to a single system, and so this protocol is also called as two wire protocol It can be used to communicate 127 devices to a single device or processor Most of I2C devices run on 100Khz frequency Steps for data write master to slave (slave receiving mode) Sends START condition to slave Sends slave address to slave Send write bit (0) to slave Received ACK bit from slave Sends words address to slave Received ACK bit from slave Sends data to slave Received ACK bit from slave And last sends STOP condition to slave Steps for data reading from slave to master (slave transmitting mode) Sends START condition to slave Sends slave address to slave Send read bit (1) to slave Received ACK bit from slave Received data from slave Received ACK bit from slave Sends STOP condition to slave Circuit Diagram and Description In circuit we have used most components DS1307, AT89S52 and LCD Here AT89S52 is used for reading time from DS1307 and display it on 16x2 LCD screen DS1307 sends time/date using lines to the microcontroller Kết n ối m ạch ện r ất đơn gi ản đượ c th ể hi ện s đồ SDA SCL chip DS1307 đượ c k ết n ối v ới chân P2.1 P2.0 c vi ều ển 89S52 v ới ện tr kéo lên giữ giá trị mặc định CAO d ữ li ệu đường đồng h Và dao động tinh th ể 32.768KHz đượ c k ết n ối v ới DS1307chip để t ạo s ự ch ậm tr ễ xác giây Và pin volt đượ c kết nối v ới pin thứ (BAT) DS1307 mà gi ữ th ời gian chạy sau thất bại ện Màn hình 16x2 đượ c kết nối với 8.051 chế độ 4-bit Các chân ều ển RS, RW En k ết n ối tr ực ti ếp t ới chân 89S52 P1.0, GND P1.1 Và chân liệu D0-D7 kết nối với P1.4-P1.7 89S52 Ba nút SET, INC / CHANGE Next s d ụng để thi ết l ập th ời gian đồng h để pin P2.4, P2.3 P2.2 89S52 (ho ạt động th ấp) Khi nhấn SET, chế độ thời gian s ẽ kích ho ạt bây gi c ần đặt th ời gian b ằng cách s d ụng nút INC / CHANGE nút Next để di chuy ển đến ch ữ s ố Sau thiết lập đồng h th ời gian liên tục Mô t ả ch ương trình Trong mã chúng tơi bao g ồm 8.051 gia đình th vi ện m ột đầu vào tiêu chu ẩn đầu vào thư viện Và chân xác định mà s d ụng, l m ột s ố biến cho tính tốn # Include #include # Xác định lcdport P1 Sbit rs = P1 ^ 0; Sbit en = P1 ^ 1; Sbit SDA = P2 ^ 1; Sbit SCL = P2 ^ 0; Sbit next = P2 ^ 2; // số tăng Sbit inc = P2 ^ 3; // gia tăng giá trị Sbit đặt = P2 ^ 4; //cài đặt thời gian Char ack; Unsigned char day1 = 1; Unsigned char k, x; unsigned int date=1, mon=1, hour=0, min=0, sec=0; int year=0; void delay(int itime) { int i,j; for(i=0;i

Ngày đăng: 13/12/2019, 14:26

Từ khóa liên quan

Mục lục

  • Đồng hồ kỹ thuật số sử dụng vi điều khiển 8.051

    • Circuit Diagram and Description

    • Mô tả chương trình

    • Program Description

Tài liệu cùng người dùng

Tài liệu liên quan