用51和四个595做一个点阵,但是仿真不出想要的结果

2019-07-18 10:29发布

四个点阵发现做列驱动时候,有些引脚没有电位变化,似乎没有控制到……希望各位高手指点指点……
程序如下,希望各位多帮帮忙,指出错误……
#include<reg52.h>
#include<intrins.h>
sbit RCKH = P2^0;
sbit SDAH = P2^2;
sbit SCKH = P2^1;
sbit SCKL = P2^4;
sbit SDAL = P2^5;
sbit RCKL = P2^3;
unsigned char hang[16]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01},
lie[32]={0xFF,0xFF,0xE0,0x0F,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xE0,0x0F,
0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xE0,0x0F,0xFF,0xFF
};

  wrh_595(unsigned char numh )
{
  unsigned char counth;
  for(counth=0;counth<=7;counth++)
{  
  SCKH = 0;
  if((numh&0x80) == 0x80)
   SDAH = 1;
  else
   SDAH = 0;
  numh<<=1;
  
  SCKH = 1;
}
}
wrl_595(unsigned char numl )
{
  unsigned char countl;
  for(countl=0;countl<=7;countl++)
{
  SCKL = 0;
  if((numl&0x80) == 0x80)
   SDAL = 1;
  else
   SDAL = 0;
  numl<<=1;
  SCKL = 1;
}
}
  void main()
{
  unsigned char t,j;
  while(1)
{  
  t=0;j=0;
  while(t<=7)
  {
   RCKL = 0;
   wrl_595(lie[j++]);
   wrl_595(lie[j++]);
   RCKL = 1;
   
   RCKH = 0;
   wrh_595(hang[t++]);
   wrh_595(0x00);
   RCKH = 1;
  }
  while(t<=15)
  {
   RCKL = 0;
   wrl_595(lie[j++]);
   wrl_595(lie[j++]);
   RCKL = 1;
   RCKH = 0;
   wrh_595(0x00);
   wrh_595(hang[t++]);
   RCKH = 1;  
  }

}
}
两个做行驱动,两个做列驱动 两个做行驱动,两个做列驱动
单片机 单片机
点阵 点阵
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
2条回答
九章子
1楼-- · 2019-07-18 13:38
http://bbs.elecfans.com/jishu_272692_1_1.html,这是网址,可以看看
516459236
2楼-- · 2019-07-18 16:17

一周热门 更多>