
admin
Tuesday, 15 October 2013 23:27
Arduino通过74HC595扩展IO
74HC595是一个价格廉宜的8位移位寄存器,通过3个数据引脚(STCP, SHCP, DS),可以控制几乎无限量的输出。
DS是一个串行数据输入端,每当时钟输入(SHCP)上升沿到来时,DS引脚当前电平值在移位寄存器中会移一位,连续进行8次同样的动作,就可以完成全部(Q0至Q7)移位。最后当STCP(Latch)上升沿到来时,移位寄存器的值将会被锁定在存储器里,并从Q0至Q7引脚输出。
Arduino UNO只有14+6个数字输出,如果需要更多的输出,其中之一的方法就是通过74HC595来取得更多的输出。
Published in
电子与电脑
Tagged under
Friday, 27 September 2013 20:40
Arduino BIT manipulations
Code below set third pin to HIGH without changing the state of any of the other pins
bitSet syntax: bitSet(x, n)
- x: the numeric variable whose bit to set
- n: which bit to set, starting at 0 for the least-significant (rightmost) bit
//initialized all pins to LOW |
Code below set third pin to LOW without changing the state of any of the other pins
bitClear syntax: bitClear(x, n)
- x: the numeric variable whose bit to clear
- n: which bit to clear, starting at 0 for the least-significant (rightmost) bit
//initialized all pins to HIGH //set the third pin LOW |
Code below set each pin as LOW or HIGH without changing the state of any of the other pins
bitWrite Syntax: bitWrite(x, n, b)
- x: the numeric variable to which to write
- n: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit
- b: the value to write to the bit (0 or 1)
byte pinState= 0; //initialized all pins to LOW (B00000000)
bitWrite(pinState, 0, HIGH); //set first pin to HIGH, pinState = B00000001 bitWrite(pinState, 3, HIGH); //set third pin to HIGH, pinState = B00001001 bitWrite(pinState, 0, LOW); //set first pin to LOW, pinState = B00001000
|
Reads a bit of a number.
bitRead Syntax: bitRead(x, n)
-
x: the number from which to read
-
n: which bit to read, starting at 0 for the least-significant (rightmost) bit
byte pinState = B10101010;
for (int i=0; i<8; i++) {
theBit = bitRead(pinState, i);
}
|
Wednesday, 25 September 2013 18:40
Using 74HC595 Shift Registers with Arduino

The 74HC595 is a very handy IC used in many microcontroller projects, it is a 8-bit serial-in, serial/parallel-out shift register with output latches.
Data is shifted on the positive-going transitions of the shift register clock input (SHCP). The data in each register is transferred to the storage register on a positive-going transition of the storage register clock input (STCP).
The shift register has a serial input (DS) and a serial standard output (Q7S) for cascading. Data in the storage register appears at the output whenever the output enable input (OE) is LOW.
This is incredibly helpful if you need more digital outputs then the 14+6 that the ATmega328 on the Arduino Uno provides, with only 3 data pins, you can control an almost unlimited amount of outputs.
Upon completion of this tutorial, you should be able to controlling the 74HC595 as below:
- Using 74HC595 Shift Registers with Arduino
- Daisy chaining 74HC595 shift registers
- Different ways (binary, decimal, hex) to hold the data using an array
- Using bitshift, bitwrite operators
- Direct port access for faster manipulation of the IO pins
Published in
Blog
Tagged under
Saturday, 17 August 2013 16:51
Minimal Arduino with 8MHz internal clock

Build your own DIY Arduino board with only one passive component, it is very easy and simple. This is probably the most minimal ATmega328 based Arduino.
Part list
-
ATmega328
-
28 pins IC socket
-
10K resistor
-
Strip board
Published in
Projects
Tagged under
Saturday, 20 July 2013 22:31
DIYLC电子绘图软件

DIYLC (DIY Layout Creato)是电子爱好者用来设计电路图的绘图软件,它可以设计原理电路图(Schematic)、洞洞电板路板(Strip board)、面包电路板等(Breadboard)。
DIYLC是一个免费与开源软件,现在是3.27.0,应该是正式使用版本了。今天试用了这版本,感觉比之前的旧版本好用了许多,很适合初学者,所以决定在此与大家分享一下。
Published in
电子与电脑
Tagged under
Saturday, 20 July 2013 15:48
魔镜制作,男人小心,女人担心
远看是美女,近看是自己。是了,这就是魔镜。
你进入厕所,有位美女笑望着你,你也色眯眯的望着美女,同时赶紧去解决你的"第一任务"。完事后,你逼不及待的靠近美女,想一亲芳泽......啊!美女不见了,眼前竞然出现一色邪男人,那不就是你自己吗!。很神奇呀!原来是魔镜在作怪。
你照着魔镜,看看自己的脸孔有没有红,看看口角有没有口水,看看鼻子有没有血,拍拍胸膛,感觉良好,要离开厕所了。忽然之间,美女又出现了。这时你脸兒红了,口角流口水了,鼻孔喷血了,心跳加速了。离开厕所後,发觉裤子也湿渗了。很励害呀,正是魔镜的法力。
一天之内,你进出厕所几十趟,结果你五孔流精,精尽人亡。很可怕呀!这就是魔镜的威力。
男士们呀!别只顾着往厕所跑,很伤身体呀!来!轻松一下,慢慢欣赏豆豆先生与魔镜的片段,暂时忘了世界上有厕所的存在。
魔镜之谜
为了拯救女人深爱的男士,英俊帅气的我不惜动用大量资金以及耗尽一生青春,同时冒著精流不止的生命危险去研究魔镜,今天终于解开了魔镜千年之谜。
为了拯救女人深爱的男士,英俊帅气的我不惜动用大量资金以及耗尽一生青春,同时冒著精流不止的生命危险去研究魔镜,今天终于解开了魔镜千年之谜。
Published in
Chinese
Tagged under
Sunday, 14 July 2013 15:20
Arduino communicate with Vixen Lighting Control Software

Vixen is a free and popular light show creator software. With a PC and some hardware, anyone can have a professional-looking lighting display synchronized to music.
The latest version is Vixen3, the most attractive feature is supported for preview. Compare to Vixen2, Vixen3 is a bit difficult to use & lack of some features in Vixen2. Please correct me if I'm wrong.
This tutorial is based on Vixen2, please download Vixen2 and install it to your computer. Prior to Vixen2, you must have install Microsot.NET Framework 2.0 in your computer.
Saturday, 13 July 2013 18:26
Connect Two Wireless Router Wirelessly ( Bridge ) using TL-MR3020

Explains how to bridge network using two wireless routers, the first (Host) router is configure as Access Point & the second router (TL-MR3020) is configure as Client mode. Same method should apply to all other OpenWRT routers as well.
Prerequisites
- Host router configure as Access Point. If you already setup a wireless internet connection in your house, usually your modem is configured as Access Point mode.
- A working OpenWRT on TP-LINK TL-MR3020 Portable 3G/4G Wireless N Router
The routers is configure as two different subnet, assume using settings below as the example.
- Host router IP: 192.168.1.1
- Host router subnet mask: 255.255.255.0 or 255.255.0.0 if you want to access 192.168.0.x from 192.168.1.x
- Host router SSID: ABC
- Client router IP: 192.168.0.1
- Client router subnet mask: 255.255.255.0
Sunday, 07 July 2013 15:40
TP-LINK TL-MR3020 + OPENWRT + WEBCAM

This project uses an inexpensive TP-LINK TL-MR3020 Portable 3G/4G Wireless N Router with an Linux UVC supported camera to create an IP Camera that can be placed in a good location for surveillance.
Prerequisites
- A working OpenWRT on TP-LINK TL-MR3020 Portable 3G/4G Wireless N Router
- Microsoft LifeCam HD-5000 or any other Linux UVC supported cameras
Saturday, 29 June 2013 16:25
Arduino电子密码锁

一个基于Arduino微控制器的密码锁,一般上用于防盗门。为了方便初学者学习与操作,这里提供了两个版本的电子密码锁源码。
读完文章与明白程序操作后,你将会如何应用:
- EEPROM字串存取
- 运用#include文件,把谋些函数(function)调去外部文件
- 简单的旋律处理
- 日期与时间处理
- 如何形成Press and hold
- 矩阵键盘应用与空闲(idle)侦察
- 密码处理与验证
- i2c LCD应用
- 非阻塞编程(Non blocking programming)
Published in
电子与电脑
Tagged under