• 已解决 73482 个问题
  • 已帮助 5993 位优秀工程师

单片机串口方式0(同步移位寄存器方式)程序问题

51874d4339592cdb 2020-07-08 浏览量:264
  1. #include <reg52.h>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. void delay_ms (uint x)
  5. {
  6.    uchar t;
  7.    while(x--)
  8.    for(t=0; t<120; t++);
  9.    }
  10.    void main()
  11.    {
  12.    uchar  i;
  13.    unsigned char table[]=(0xc0 0xf9 0xa4 0xb0 0x99 0x92 0x82 0xf8 0x80 0x90);
  14.    SCON=0x00;
  15.    while(i<10)
  16.    {
  17.    SBUF=table [i];
  18.    while(!TI);
  19.    TI=0;
  20.    i=(i+1)%10;
  21.    delay_ms(1000);
  22.    }
  23. }
0 0 收起

我来回答

上传资料:
选择文件 文件大小不超过15M(格式支持:doc、ppt、xls、pdf、zip、rar、txt)
最佳答案
  • 这个程序的main函数设计有问题,它运行一次就退出了,应该要弄个for(;;)这样的东西,令其循环运行
    • 发布于 2020-07-20
    • 举报
    • 评论 0
    • 0
    • 0

其他答案 数量:0

相关问题

问题达人换一批

单片机串口方式0(同步移位寄存器方式)程序问题