微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 11路AD转换TLC2543CN c程序

11路AD转换TLC2543CN c程序

时间:11-29 来源:互联网 点击:

采用1602液晶来显示转换结果,端口可以很方便的自己修改的

#include #include #include  #define uchar unsigned char#define uint  unsigned int#include#define uchar unsigned char#define uint unsigned intuchar vol[3]={000},channel[11]={0x0c,0x1c,0x2c,0x3c,0x4c,0x5c,0x6c,0x7c,0x8c,0x9c,0xac};/* 端口定义*/#define LCD_data  P0             //数据口sbit inter_0=P3^2;sbit LCD_RS  =  P2^7;            //寄存器选择输入sbit LCD_RW  =  P2^6;            //液晶读/写控制sbit LCD_EN  =  P2^5;            //液晶使能控制sbit LCD_PSB =  P2^4;            //串/并方式控制sbit eoc=P1^0;sbit clock=P1^1;sbit in=P1^2;sbit out=P1^3;sbit cs=P1^4;uint din;void delay(uint x){uint i,j;for(j=0;j>=4;num=din/4096.0*5.0;num1[0]=(uint)(num)%10+48;num1[1]=46;num1[2]=((uint)(num*10))%10+48;num1[3]=((uint)(num*100))%10+48;lcd_pos(k/3,k%3*3);delay(5);write_dat(num1[0]);delay(5);write_dat(num1[1]);delay(5);write_dat(num1[2]);delay(5);write_dat(num1[3]);delay(5);k++;}}}/*************************************/

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top