欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機74HC595點陣數據傳輸有錯誤 [打印本頁]

作者: ygdy1    時間: 2021-1-11 15:38
標題: 單片機74HC595點陣數據傳輸有錯誤

代碼和仿真都發上了
顯示1是正常的,其他的就開始亂了

這個是顯示1、2、3
  1. #include<reg51.h>
  2. #include "intrins.h"
  3. #include "char.h"
  4. #define uint unsigned int
  5. #define uchar unsigned char
  6. sbit ser=P0^3;//ser 14
  7. sbit sck=P0^4;//sck 11
  8. sbit rck=P0^5;//rck 12
  9. sbit rst=P3^0;//復位信號
  10. //==============================================================
  11. void delay(uint ii){uint i;for(i=0;i<ii;i++);}
  12. //==============================================================
  13. void SendByte(uchar cc)         //發送
  14. {
  15.         uchar c=cc;
  16.         int i;
  17.   //=串行發送=
  18.   for(i=0;i<8;i++)
  19.   {            sck=0;
  20.                   ser=c>>7;
  21.                 c<<=1;
  22.                 sck=1;
  23.            }
  24.            //=并行發送=
  25.            rck=1;
  26.            _nop_();
  27.        _nop_();
  28.            rck=0;
  29.            //=復位=
  30.            rst=0;
  31.                 _nop_();
  32.        _nop_();
  33.            rst=1;
  34.            }

  35. //==============================================================
  36. void PutChar(char ci) //分解
  37. {
  38.         int i,j;
  39.   for(i=0;i<200;i++)
  40.   for(j=0;j<6;j++)
  41.   {
  42.           P1=j;         
  43.           SendByte(vc[ci-0x20][j]); //ASCII
  44.         _nop_();
  45.     _nop_();
  46.         SendByte(0);
  47.   }
  48. }
  49. //=============================================================
  50. void PutStr(char *str)
  51. {int i=0;
  52. while(str[i]!=0)
  53. {
  54.          PutChar(str[i]);
  55.          i++;
  56. }

  57. }
  58. //============================================================
  59. void main()
  60. {
  61.         rck=0;
  62.   while(1){
  63.           PutStr("123");
  64.         
  65.   }
  66. }

復制代碼



1.zip (55.83 KB, 下載次數: 8)





作者: 人人學會單片機    時間: 2021-1-11 16:08
89單片機+四個74HC595的LED16x16點陣 程序源碼原理圖 你可以用我們的代碼
http://m.raoushi.com/bbs/dpj-200961-1.html
作者: xianfajushi    時間: 2021-1-11 16:28
  1. void PutChar(char ci) //分解
  2. {
  3.         int i,j;
  4.   for(i=0;i<200;i++)
  5.   for(j=0;j<=6;j++)
  6.   {
  7.           P1=j;         
  8.           SendByte(vc[ci-0x20][j]); //ASCII
  9.         _nop_();
  10.     _nop_();
  11.         SendByte(0);
  12.   }
  13. }
復制代碼

作者: ygdy1    時間: 2021-1-11 17:03
xianfajushi 發表于 2021-1-11 16:28

謝謝大佬!
作者: 名字不是重點    時間: 2021-1-11 17:06
595數據輸出口在上電后是隨機的,所以,你在上電后要做清除動作,即,送出0x00,多少個595就送多少個0x00

作者: 名字不是重點    時間: 2021-1-11 17:18
595的MR腳要接阻容復位或直接電源,OE要受控。你這電路不強壯。




歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1