好像我前面真的说错了,我说反了,以下是我百度查的
例如:数据0xff,0x00.当你写玩第一个数据0xff时已经放在第一个595的锁存器中,当你在写多一次时0x00就放在第二个595中;接着一起讲数据输出就行了
lanxix 发表于 2012-9-16 23:04 static/image/common/back.gif
好像我前面真的说错了,我说反了,以下是我百度查的
这样啊,我一直以为是先写0xff,第一片得到这个数据,再写0x00,那么oxff移位到第二片,第一片更新成0x00.
萧芸凤 发表于 2012-9-16 23:24 static/image/common/back.gif
这样啊,我一直以为是先写0xff,第一片得到这个数据,再写0x00,那么oxff移位到第二片,第一片更新成0x00.
我做了个例子,你看下吧
http://www.geek-workshop.com/forum.php?mod=viewthread&tid=1928&page=1&extra=#pid13987
效果不错,照着官网比对着做的
http://www.arduino.cc/en/Tutorial/ShiftOut
幻生幻灭 发表于 2012-11-14 19:40 static/image/common/back.gif
效果不错,照着官网比对着做的
http://www.arduino.cc/en/Tutorial/ShiftOut
{:soso_e154:} 74HC系列偶还不会用
幻生幻灭 发表于 2012-11-14 19:40 static/image/common/back.gif
效果不错,照着官网比对着做的
http://www.arduino.cc/en/Tutorial/ShiftOut
排阻是个好东西,这样一来简洁的多了
595好东西啊,就是比138贵,所以如果是点阵的话,考虑到扫描只需要一位enable,所以扫描用138,给数据用595,就能达到最佳性价比了,可惜138级联我还没整明白。
内行看门道,外行看例子,学习了。谢谢弘毅:lol
求解关于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 isthe 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);
}
留个言,好找。不过副秘书长是个什么?
本帖最后由 疯子。 于 2013-4-28 13:44 编辑
第一张图和第二张图的接脚怎么不一样?
17. /*这个就是用MSBFIRST参数让0-7个针脚以高电平输出(LSBFIRST 低电平)是dataPin的参数,
这句的也可以这样理解,设置MSBFIRST参数的意思应该是8位数据的高位由Q7输出,最低位由Q0输出。如需要输出的数据为(MSB)01010101(LSB),在74HC595的
输出端Q7~Q0对应输出为01010101.如设为LSBFIRST则输出端Q7~Q0对应输出为10101010.
普通人 发表于 2013-4-12 18:39 static/image/common/back.gif
留个言,好找。不过副秘书长是个什么?
我想那个应该是机器人翻译的效果吧,呵呵! 百度一下即可知道引脚定义了。
zbbs000 发表于 2013-6-24 14:54 static/image/common/back.gif
17. /*这个就是用MSBFIRST参数让0-7个针脚以高电平输出(LSBFIRST 低电平)是dataPin的参数,
这句的也 ...
赞同!
另猜想,级联时应该大于256的数输入,输入方式还是和一块一样。只是超过256的数据,就溢出从Q7#串行输出到下一个芯片,就好比自己的串行输入。可能是每一个十进制256就表示1个8位,那256就应该表示为11111111+溢出一个1十进制=11111111+00000001,这里从右开始。可是,要是想让每块595都只第0号引脚输出该怎么办呢??
那这种猜想就不正确了。。。还是回去看书吧。。。哎。。
如果用595带几个全彩(3色)LED,是两种否可行呢?看您帖子说的,Q0~Q7是数字脚,也就是只有0、1两种状态吗?如果是这样的话,是不是真的只有3色了?