仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)
单片机源程序如下:
- /*----------------------Item Description-----------------------------------
- - Project Name : TLC1543.c
- - Files :
- - Description : None
- - IDE : Keil uVision4
- - Author : Mason 别名:小菜
- - Email Address : 1609099954@qq.com
- - Create Date : 2013/7/27
- - Performance : Finished
- - -------------------------------------------
- - Revision History
- - No. Date Revised by Item Description
- -
- -------------------------------------------------------------------------*/
- #include <reg52.h>
- #include "MICRO.h"
- #include "LCD1602.h"
- #include "TLC1543.h"
- void main()
- {
- uint16 volt;
- LCD1602_Init(); // LCD1602上电初使化
- draw1602_basic();
- TLC1543_init();
- while(1)
- {
- volt = ReadADC_TLC1543(0);
- write1602_DDRAM_pos(7,1);
- write1602_byte(volt/1000+0x30,1);
- write1602_byte(volt/100%10+0x30,1);
- write1602_byte(volt/10%10+0x30,1);
- write1602_byte(volt%10+0x30,1);
- }
- }
复制代码- /*----Head Description----
- - File Name : TLC1543.H
- - Author : Mason 别名:小菜
- - Create Date : 2013/7/26
- - -------------------------------------------
- - Revision History
- - No. Date Revised by Item Description
- -
- -------------------------------------------------------------------------*/
- #ifndef _TLC1543_H_
- #define _TLC1543_H_
- /*----------------------------Head---------------------------------------*/
- #include <reg52.h>
- #include "MICRO.h"
- /*----------------------------Interface----------------------------------*/
- sbit EOC_1543 = P3^7;
- sbit SCLK_1543 = P3^5;
- sbit ADDR_1543 = P3^3;
- sbit DOUT_1543 = P3^2;
- sbit CS_1543 = P3^4;
- /*----------------------------Function Declaration-----------------------*/
- uint16 ReadADC_TLC1543(uchar ain);
- void TLC1543_init(void);
- #endif
复制代码
所有资料51hei提供下载:
TLC1543.7z
(48.07 KB, 下载次数: 87)
|