Skip to content

Commit 3fa3dcb

Browse files
update
1 parent 41d6945 commit 3fa3dcb

17 files changed

+3384
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- 100uF 50V電容 * 20
1919

2020
misc
21-
- 40w 烙鐵 * 5
21+
- 40w 烙鐵 * 10
2222
- 斜嘴鉗 * 10
2323
- 剪刀 * 10
2424
- 無煙錫 * 1KG
@@ -27,4 +27,7 @@ misc
2727
- 單芯線(黑)(60米) GND線路用
2828
- 多種顏色單芯線 接線debug用
2929
- 20cm杜邦線(公對公) * 200
30+
- 熱縮套(細) * 10
31+
- 海綿 * 6
32+
- 吸錫槍 * 3
3033

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
#ifndef SHIFTOUT_H
3+
#define SHIFTOUT_H
4+
5+
#include<regx51.h>
6+
7+
//DS
8+
#ifndef DATA_PIN
9+
#define DATA_PIN P1_0
10+
#endif
11+
12+
//SHCP
13+
#ifndef CLOCK_PIN
14+
#define CLOCK_PIN P1_1
15+
#endif
16+
17+
#define MSBFIRST 1
18+
#define LSBFIRST 2
19+
20+
/*
21+
* delay for pin physical voltage operation
22+
*/
23+
void clock_delay()
24+
{
25+
unsigned i;
26+
for (i = 0 ; i < 5 ; i++);
27+
}
28+
29+
void shiftOut(unsigned char BitOrder,unsigned char val)
30+
{
31+
unsigned char i;
32+
for (i = 0 ; i < 8 ; i++){
33+
if (BitOrder == LSBFIRST)
34+
DATA_PIN = !!(val & (1<<i));
35+
else
36+
DATA_PIN = !!(val & (1<<(7-i)));
37+
clock_delay();
38+
CLOCK_PIN = 1;
39+
clock_delay();
40+
CLOCK_PIN = 0;
41+
}
42+
}
43+
44+
#endif

0 commit comments

Comments
 (0)