-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmax6921.ino
68 lines (55 loc) · 1.34 KB
/
max6921.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//quick vfd tube driver test
// MAX6921
// datasheet: http://datasheets.maximintegrated.com/en/ds/MAX6921-MAX6931.pdf
int clk = 2;
int load = 1;
int din = 0;
int led = 13;
int blank = 7;
void setup() {
pinMode(din, OUTPUT);
pinMode(load, OUTPUT);
pinMode(clk, OUTPUT);
pinMode(blank, OUTPUT);
digitalWrite(blank, LOW);
digitalWrite(clk, LOW);
digitalWrite(load, LOW);
digitalWrite(din, LOW);
}
// the loop routine runs over and over again forever:
void loop() {
// toggle LED to mark start
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
// wait 3 seconds for setting up logic analyzer
delay(3000);
// write OUT19 with first clock signal
digitalWrite(din, HIGH);
delay(10);
digitalWrite(clk, HIGH);
delay(5);
// turn off the other OUTs
digitalWrite(din, LOW);
delay(5);
// clock 0 to other loads
for(int i=0;i<19;i++) {
digitalWrite(clk, LOW);
delay(10);
digitalWrite(clk, HIGH);
delay(10);
}
digitalWrite(clk, LOW);
// load the changes
digitalWrite(load, HIGH);
delay(10);
digitalWrite(load, LOW);
digitalWrite(din, LOW);
// do nothing more
for(;;) {};
}