热门

最新

红包

立Flag

投票

同城

我的

发布
weixin_46264968
`苏苏苏苏
4 年前
trueweixin_46264968

救救孩子吧,一道单片机题目:使用74LS165完成并行数据到串行数据的转换,拨码开关控制数码管的显示。例如按下D0,显示0;D1显示1以此类推。啊啊啊要怎么写呀!!!!!!附上我写的代码(菜鸟乱写的)求解答…
。    ∧_∧。゚
 ゚  (゚ ´Д`゚)っ゚
   (つ  /
    | (⌒)
    し⌒


#include <reg52.h>
#include <intrins.h>
#include <stdio.h>
#define uint unsigned int
#define uchar unsigned char
sbit SPL = P2^5;
uchar code DSY_CODE[]=
{
0x00,0x3f,0x06,0x5b,0x4f,0x66,0x6d, 0x7d,0x07,0x7f,0x6f
};
void Delay(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}

void main()
{
uchar temp;
SCON = 0x10;
while(1)
{
SPL = 0;
SPL = 1;
while(RI == 0);
RI = 0;
temp=~SBUF;
P0 = DSY_CODE[temp];
Delay(200);
}
}

你问我答
CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
我是怎么从外包干到阿里巴巴的
立即登录