极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: 弘毅

关于74hc595芯片的实验-arduino串入并出实验(转)

  [复制链接]
发表于 2012-9-16 23:04:44 | 显示全部楼层
好像我前面真的说错了,我说反了,以下是我百度查的


例如:数据0xff,0x00.当你写玩第一个数据0xff时已经放在第一个595的锁存器中,当你在写多一次时0x00就放在第二个595中;接着一起讲数据输出就行了
回复 支持 反对

使用道具 举报

发表于 2012-9-16 23:24:25 | 显示全部楼层
lanxix 发表于 2012-9-16 23:04
好像我前面真的说错了,我说反了,以下是我百度查的

这样啊,我一直以为是先写0xff,第一片得到这个数据,再写0x00,那么oxff移位到第二片,第一片更新成0x00.
回复 支持 反对

使用道具 举报

发表于 2012-9-17 03:29:48 | 显示全部楼层
萧芸凤 发表于 2012-9-16 23:24
这样啊,我一直以为是先写0xff,第一片得到这个数据,再写0x00,那么oxff移位到第二片,第一片更新成0x00.

我做了个例子,你看下吧

http://www.geek-workshop.com/for ... amp;extra=#pid13987
回复 支持 反对

使用道具 举报

发表于 2012-11-14 19:40:58 | 显示全部楼层


效果不错,照着官网比对着做的
http://www.arduino.cc/en/Tutorial/ShiftOut

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-11-14 20:08:57 | 显示全部楼层
幻生幻灭 发表于 2012-11-14 19:40
效果不错,照着官网比对着做的
http://www.arduino.cc/en/Tutorial/ShiftOut

{:soso_e154:} 74HC系列偶还不会用
回复 支持 反对

使用道具 举报

发表于 2012-12-3 11:20:54 | 显示全部楼层
幻生幻灭 发表于 2012-11-14 19:40
效果不错,照着官网比对着做的
http://www.arduino.cc/en/Tutorial/ShiftOut

排阻是个好东西,这样一来简洁的多了
回复 支持 反对

使用道具 举报

发表于 2012-12-3 11:22:52 | 显示全部楼层
595好东西啊,就是比138贵,所以如果是点阵的话,考虑到扫描只需要一位enable,所以扫描用138,给数据用595,就能达到最佳性价比了,可惜138级联我还没整明白。
回复 支持 反对

使用道具 举报

发表于 2012-12-6 19:41:08 | 显示全部楼层
内行看门道,外行看例子,学习了。谢谢弘毅
回复 支持 反对

使用道具 举报

发表于 2013-4-2 16:50:55 | 显示全部楼层
求解关于74HC595的疑惑

做了以下实验,可是不知为什么子要把手指放到靠近capacitor(电容) 上端16个LED灯就会一个一个的亮起来然后熄灭。手指不靠近时LED灯就不亮

电路图


Arduino 代码:
//Shift Regidter Example for two 74HC595 shift register

//this sketch turns on each of the LEDs attached to two 74HC595 shift register, in sequence from output 0 to output 15.
const int latchPin = 4;
const int clockPin = 5;
const int dataPin = 2;

void setup()
{
//set pins to output because they are address in the main loop
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
Serial.begin(9600);
Serial.println("resent");
}

void loop() {
  // iterate over the 16 outputs of the two shift registers
  for (int thisLed = 0; thisLed < 16; thisLed++) {
    // write data to the shift registers:
    registerWrite(thisLed, HIGH);
    // if this is not the first LED, turn off the previous LED:
    if (thisLed > 0) {
      registerWrite(thisLed - 1, LOW);
    }
    // if this is  the first LED, turn off the highest LED:
    else {
      registerWrite(15, LOW);
    }
    // pause between LEDs:
    delay(500);
  }

}

// This method sends bits to the shift registers:

void registerWrite(int whichPin, int whichState) {
  // the bits you want to send. Use an unsigned int,
  // so you can use all 16 bits:
  unsigned int bitsToSend = 0;   

  // turn off the output so the pins don't light up
  // while you're shifting bits:
  digitalWrite(latchPin, LOW);

  // turn on the next highest bit in bitsToSend:
  bitWrite(bitsToSend, whichPin, whichState);

  // break the bits into two bytes, one for
  // the first register and one for the second:
  byte registerOne = highByte(bitsToSend);
  byte registerTwo = lowByte(bitsToSend);

  // shift the bytes out:
  shiftOut(dataPin, clockPin, MSBFIRST, registerTwo);
  shiftOut(dataPin, clockPin, MSBFIRST, registerOne);

  // turn on the output so the LEDs can light up:
  digitalWrite(latchPin, HIGH);
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2013-4-12 18:39:13 | 显示全部楼层
留个言,好找。不过副秘书长是个什么?
回复 支持 反对

使用道具 举报

发表于 2013-4-28 13:42:25 | 显示全部楼层
本帖最后由 疯子。 于 2013-4-28 13:44 编辑

第一张图和第二张图的接脚怎么不一样?
回复 支持 反对

使用道具 举报

发表于 2013-6-24 14:54:30 | 显示全部楼层
17.    /*这个就是用MSBFIRST参数让0-7个针脚以高电平输出(LSBFIRST 低电平)是dataPin的参数,
这句的也可以这样理解,设置MSBFIRST参数的意思应该是8位数据的高位由Q7输出,最低位由Q0输出。如需要输出的数据为(MSB)01010101(LSB),在74HC595的
输出端Q7~Q0对应输出为01010101.如设为LSBFIRST则输出端Q7~Q0对应输出为10101010.
回复 支持 反对

使用道具 举报

发表于 2013-9-10 22:37:50 | 显示全部楼层
普通人 发表于 2013-4-12 18:39
留个言,好找。不过副秘书长是个什么?

我想那个应该是机器人翻译的效果吧,呵呵! 百度一下即可知道引脚定义了。
回复 支持 反对

使用道具 举报

发表于 2013-9-10 22:50:46 | 显示全部楼层
zbbs000 发表于 2013-6-24 14:54
17.    /*这个就是用MSBFIRST参数让0-7个针脚以高电平输出(LSBFIRST 低电平)是dataPin的参数,
这句的也 ...

赞同!

另猜想,级联时应该大于256的数输入,输入方式还是和一块一样。只是超过256的数据,就溢出从Q7#串行输出到下一个芯片,就好比自己的串行输入。可能是每一个十进制256就表示1个8位,那256就应该表示为11111111+溢出一个1十进制=11111111+00000001,这里从右开始。  可是,要是想让每块595都只第0号引脚输出该怎么办呢??

那这种猜想就不正确了。。。还是回去看书吧。。。哎。。
回复 支持 反对

使用道具 举报

发表于 2014-9-21 23:33:13 | 显示全部楼层
如果用595带几个全彩(3色)LED,是两种否可行呢?看您帖子说的,Q0~Q7是数字脚,也就是只有0、1两种状态吗?如果是这样的话,是不是真的只有3色了?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-26 08:55 , Processed in 0.043783 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表