虫虫首页|资源下载|资源专辑|精品软件
登录|注册

uchar

  • //1602液晶显示字屏为:TX-1C MCU GOTOYUNLONGDZ #include<reg52.h> #define uchar unsigned char #defi

    //1602液晶显示字屏为:TX-1C MCU GOTOYUNLONGDZ #include<reg52.h> #define uchar unsigned char #define uint unsigned int

    标签: GOTOYUNLONGDZ unsigned include define

    上传时间: 2014-11-14

    上传用户:caiiicc

  • 遥控解码通过电脑串口显示 /* 晶振:11.0569MHz */ #include <REGX52.h> #define uchar unsigned char uchar d

    遥控解码通过电脑串口显示 /* 晶振:11.0569MHz */ #include <REGX52.h> #define uchar unsigned char uchar data IRcode[4] //定义一个4字节的数组用来存储代码 uchar CodeTemp //编码字节缓存变量 uchar i,j,k //延时用的循环变量 sbit IRsignal=P3^2 //HS0038接收头OUT端直接连P3.2(INT0) /**************************延时0.9ms子程序**********************/ void Delay0_9ms(void) {uchar j,k for(j=18 j>0 j--) for(k=20 k>0 k--) } /***************************延时1ms子程序**********************/ void Delay1ms(void) {uchar i,j for(i=2 i>0 i--) for(j=230 j>0 j--) }

    标签: uchar unsigned 11.0569 include

    上传时间: 2013-12-11

    上传用户:Breathe0125

  • 如何编写读/写一个字节的函数呢? 1. 读一个字节 uchar tmpread(void) //read a byte date 读一个字节 { uchar i,j,dat dat=0

    如何编写读/写一个字节的函数呢? 1. 读一个字节 uchar tmpread(void) //read a byte date 读一个字节 { uchar i,j,dat dat=0 for(i=1 i<=8 i++) { j=tmpreadbit() dat=(j<<7)|(dat>>1) //读出的数据最低位在最前面,这样刚好一个字节在DAT里 } return(dat) //将一个字节数据返回 }

    标签: uchar dat tmpread read

    上传时间: 2017-09-06

    上传用户:gengxiaochao

  • 内容摘要: LHD6000主板主芯片程序 ISD1730时序说明: 参考:void Send_1Byte(uchar ucData_s)和uchar Receive_1Byte(void)的说明.

    内容摘要: LHD6000主板主芯片程序 ISD1730时序说明: 参考:void Send_1Byte(uchar ucData_s)和uchar Receive_1Byte(void)的说明. 应先发"RESET"命令再发"PWR_UP"命令,后发"RESET"命令可能不正常工作. 1730最高地址只有0xFF,所以对指定地址的操作函数的参数使用了"unsigned char"类型, 17系列的其它型号可能才用得到"unsigned int",借用时注意,将对应注释掉的部分还原.!!

    标签: uchar Byte void ucData_s

    上传时间: 2017-09-11

    上传用户:zm7516678

  • LCD12864显示汉字和数字(程序和电路)

    附件为:LCD12864显示汉字和数字的程序与电路 /*  自定义延时子函数 */ void delayms(uchar z) {   int x,y;   for(x=z;x>0;x--)      for(y=110;y>0;y--); } /*      判断LCD忙信号状态 */ void buys() {   int dat;   RW=1;   RS=0;   do     {           P0=0x00;          E=1;    dat=P0;    E=0;    dat=0x80 & dat;   } while(!(dat==0x00)); } /*      LCD写指令函数 */ void w_com(uchar com) {   //buys();   RW=0;   RS=0;   E=1;   P0=com;   E=0; }  /*      LCD写数据函数 */ void w_date(uchar date) {   //buys();   RW=0;   RS=1;   E=1;   P0=date;   E=0; } /*     LCD选屏函数 */ void select_screen(uchar screen) {     switch(screen)     {         case 0:     //选择全屏                 CS1=0;        CS2=0;           break;      case 1:     //选择左屏                 CS1=0;        CS2=1;           break;                          case 2:     //选择右屏                 CS1=1;        CS2=0;           break;    /*  case 3:     //选择右屏                 CS1=1;          CS2=1;               break;    */     }           } /*   LCDx向上滚屏显示 */ void lcd_rol() {     int x;     for(x=0;x<64;x++)        {       select_screen(0);     w_com(0xc0+x);       delayms(500);     } } /*     LCD清屏函数:清屏从第一页的第一列开始,总共8页,64列 */ void clear_screen(screen) {   int x,y;   select_screen(screen);     //screen:0-选择全屏,1-选择左半屏,2-选择右半屏   for(x=0xb8;x<0xc0;x++)   //从0xb8-0xbf,共8页      {    w_com(x);    w_com(0x40);   //列的初始地址是0x40    for(y=0;y<64;y++)       {            w_date(0x00);              }       }    } /*   LCD显示汉字字库函数 */ void lcd_display_hanzi(uchar screen,uchar page,uchar col,uint mun) {  //screen:选择屏幕参数,page:选择页参数0-3,col:选择列参数0-3,mun:显示第几个汉字的参数       int a;    mun=mun*32;    select_screen(screen);    w_com(0xb8+(page*2));    w_com(0x40+(col*16));    for ( a=0;a<16;a++)       {        w_date(hanzi[mun++]);       }    w_com(0xb8+(page*2)+1);    w_com(0x40+(col*16));    for ( a=0;a<16;a++)       {        w_date(hanzi[mun++]);       } }  /*   LCD显示字符字库函数 */ void lcd_display_zifuk(uchar screen,uchar page,uchar col,uchar mun) {  //screen:选择屏幕参数,page:选择页参数0-3,col:选择列参数0-7,mun:显示第几个汉字的参数       int a;    mun=mun*16;    select_screen(screen);    w_com(0xb8+(page*2));    w_com(0x40+(col*8));    for ( a=0;a<8;a++)       {        w_date(zifu[mun++]);       }    w_com(0xb8+(page*2)+1);    w_com(0x40+(col*8));    for ( a=0;a<8;a++)       {        w_date(zifu[mun++]);       } } /*   LCD显示数字字库函数 */ void lcd_display_shuzi(uchar screen,uchar page,uchar col,uchar mun) {  //screen:选择屏幕参数,page:选择页参数0-3,col:选择列参数0-7,mun:显示第几个汉字的参数       int a;    mun=mun*16;    select_screen(screen);    w_com(0xb8+(page*2));    w_com(0x40+(col*8));    for ( a=0;a<8;a++)       {        w_date(shuzi[mun++]);       }    w_com(0xb8+(page*2)+1);    w_com(0x40+(col*8));    for ( a=0;a<8;a++)       {        w_date(shuzi[mun++]);       } } /*   LCD初始化函数 */ void lcd_init() {   w_com(0x3f);   //LCD开显示   w_com(0xc0);   //LCD行初始地址,共64行   w_com(0xb8);   //LCD页初始地址,共8页   w_com(0x40);   //LCD列初始地址,共64列     } /*   LCD显示主函数 */ void main() {   //第一行       int x;    lcd_init();     //LCD初始化    clear_screen(0);    //LCD清屏幕    lcd_display_shuzi(1,0,4,5);    //LCD显示数字    lcd_display_shuzi(1,0,5,1);    //LCD显示数字       lcd_display_hanzi(1,0,3,0);    //LCD显示汉字    lcd_display_hanzi(2,0,0,1);    //LCD显示汉字    //LCD字符汉字    lcd_display_hanzi(2,0,1,2);    //LCD显示汉字   //第二行     lcd_display_zifuk(1,1,2,0);    //LCD显示字符    lcd_display_zifuk(1,1,3,0);    //LCD显示字符    lcd_display_zifuk(1,1,4,0);    //LCD显示字符    lcd_display_zifuk(1,1,5,4);    //LCD显示字符    lcd_display_shuzi(1,1,6,8);    //LCD显示字符    lcd_display_shuzi(1,1,7,9);    //LCD显示字符    lcd_display_shuzi(2,1,0,5);    //LCD显示字符    lcd_display_shuzi(2,1,1,1);    //LCD显示字符    lcd_display_zifuk(2,1,2,4);    lcd_display_zifuk(2,1,3,1);    lcd_display_zifuk(2,1,4,2);    lcd_display_zifuk(2,1,5,3);   //第三行    for(x=0;x<4;x++)       {      lcd_display_hanzi(1,2,x,3+x);    //LCD显示汉字    }      for(x=0;x<4;x++)       {      lcd_display_hanzi(2,2,x,7+x);    //LCD显示汉字    }   //第四行     for(x=0;x<4;x++)       {      lcd_display_zifuk(1,3,x,5+x);    //LCD显示汉字    }     lcd_display_shuzi(1,3,4,7);     lcd_display_shuzi(1,3,5,5);     lcd_display_shuzi(1,3,6,5);     lcd_display_zifuk(1,3,7,9);     lcd_display_shuzi(2,3,0,8);     lcd_display_shuzi(2,3,1,9);     lcd_display_shuzi(2,3,2,9);     lcd_display_shuzi(2,3,3,5);     lcd_display_shuzi(2,3,4,6);     lcd_display_shuzi(2,3,5,8);     lcd_display_shuzi(2,3,6,9);     lcd_display_shuzi(2,3,7,2);        while(1);    /* while(1)     {     //  LCD向上滚屏显示        lcd_rol();     }    */ }

    标签: 12864 LCD 汉字 数字

    上传时间: 2013-11-08

    上传用户:aeiouetla

  • TLC2543 中文资料

    TLC2543是TI公司的12位串行模数转换器,使用开关电容逐次逼近技术完成A/D转换过程。由于是串行输入结构,能够节省51系列单片机I/O资源;且价格适中,分辨率较高,因此在仪器仪表中有较为广泛的应用。 TLC2543的特点 (1)12位分辩率A/D转换器; (2)在工作温度范围内10μs转换时间; (3)11个模拟输入通道; (4)3路内置自测试方式; (5)采样率为66kbps; (6)线性误差±1LSBmax; (7)有转换结束输出EOC; (8)具有单、双极性输出; (9)可编程的MSB或LSB前导; (10)可编程输出数据长度。 TLC2543的引脚排列及说明    TLC2543有两种封装形式:DB、DW或N封装以及FN封装,这两种封装的引脚排列如图1,引脚说明见表1 TLC2543电路图和程序欣赏 #include<reg52.h> #include<intrins.h> #define uchar unsigned char #define uint unsigned int sbit clock=P1^0; sbit d_in=P1^1; sbit d_out=P1^2; sbit _cs=P1^3; uchar a1,b1,c1,d1; float sum,sum1; double  sum_final1; double  sum_final; uchar duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uchar wei[]={0xf7,0xfb,0xfd,0xfe};  void delay(unsigned char b)   //50us {           unsigned char a;           for(;b>0;b--)                     for(a=22;a>0;a--); }  void display(uchar a,uchar b,uchar c,uchar d) {    P0=duan[a]|0x80;    P2=wei[0];    delay(5);    P2=0xff;    P0=duan[b];    P2=wei[1];    delay(5);   P2=0xff;   P0=duan[c];   P2=wei[2];   delay(5);   P2=0xff;   P0=duan[d];   P2=wei[3];   delay(5);   P2=0xff;   } uint read(uchar port) {   uchar  i,al=0,ah=0;   unsigned long ad;   clock=0;   _cs=0;   port<<=4;   for(i=0;i<4;i++)  {    d_in=port&0x80;    clock=1;    clock=0;    port<<=1;  }   d_in=0;   for(i=0;i<8;i++)  {    clock=1;    clock=0;  }   _cs=1;   delay(5);   _cs=0;   for(i=0;i<4;i++)  {    clock=1;    ah<<=1;    if(d_out)ah|=0x01;    clock=0; }   for(i=0;i<8;i++)  {    clock=1;    al<<=1;    if(d_out) al|=0x01;    clock=0;  }   _cs=1;   ad=(uint)ah;   ad<<=8;   ad|=al;   return(ad); }  void main()  {   uchar j;   sum=0;sum1=0;   sum_final=0;   sum_final1=0;    while(1)  {              for(j=0;j<128;j++)          {             sum1+=read(1);             display(a1,b1,c1,d1);           }            sum=sum1/128;            sum1=0;            sum_final1=(sum/4095)*5;            sum_final=sum_final1*1000;            a1=(int)sum_final/1000;            b1=(int)sum_final%1000/100;            c1=(int)sum_final%1000%100/10;            d1=(int)sum_final%10;            display(a1,b1,c1,d1);           }         } 

    标签: 2543 TLC

    上传时间: 2013-11-19

    上传用户:shen1230

  • MEGA16制作的电子时钟(附仿真图+源代码)

    #include <iom16v.h> #include <macros.h> #define uchar unsigned char #define uint unsigned int uchar num,miao,fen,shi,miaoge,miaoshi,fenge,fenshi,shig

    标签: MEGA 16 电子时钟 仿真图

    上传时间: 2013-10-14

    上传用户:sc965382896

  • AVR单片机数码管秒表显示

    #include<iom16v.h> #include<macros.h> #define uint unsigned int #define uchar unsigned char uint a,b,c,d=0; void delay(c) { for for(a=0;a<c;a++) for(b=0;b<12;b++); }; uchar tab[]={ 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,

    标签: AVR 单片机 数码管

    上传时间: 2013-10-21

    上传用户:13788529953

  • c51流水灯仿真与程序

    对应程序: #include<reg52.h> #define uint unsigned int #define uchar unsigned char uchar code tab[]={ 0x81, 0x42, 0x24, 0x18, }; void delay(uint z) { uint i,j; for(i=z;i>0;i--) for(j=120;j>0;j--); } void init() { P0=0x00; }

    标签: c51 流水灯 仿真 程序

    上传时间: 2014-01-16

    上传用户:ruan2570406

  • 51单片机实现的RS485通讯程序

      #ifndef __485_C__   #define __485_C__   #include   #include   #define unsigned char uchar   #define unsigned int uint   /* 通信命令 */   #define __ACTIVE_ 0x01 // 主机询问从机是否存在   #define __GETDATA_ 0x02 // 主机发送读设备请求   #define __OK_ 0x03 // 从机应答   #define __STATUS_ 0x04 // 从机发送设备状态信息   #define __MAXSIZE 0x08 // 缓冲区长度   #define __ERRLEN 12 // 任何通信帧长度超过12则表示出错   uchar dbuf[__MAXSIZE]; // 该缓冲区用于保存设备状态信息   uchar dev; // 该字节用于保存本机设备号   sbit M_DE = P1^0; // 驱动器使能,1有效   sbit M_RE = P1^1; // 接收器使能,0有效

    标签: 485 RS 51单片机 通讯程序

    上传时间: 2014-12-26

    上传用户:604759954