11路AD轉(zhuǎn)換TLC2543CN c程序
采用1602液晶來顯示轉(zhuǎn)換結(jié)果,端口可以很方便的自己修改的
本文引用地址:http://www.ex-cimer.com/article/201611/323301.htm#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 //數(shù)據(jù)口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++;}}}/*************************************/
評論