Skip to content

Commit 6ba149d

Browse files
committed
v8a and v8b isolated tests; mods to code for v8a and v8b (untested)
1 parent cc5ff2e commit 6ba149d

File tree

12 files changed

+379
-97
lines changed

12 files changed

+379
-97
lines changed

sixtube_lm/configs/v5-4tube.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7373

7474
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
7575
const unsigned long timeoutSet = 120; //sec
76-
const unsigned long timeoutTempFn = 5; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v5-6tube-red.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7373

7474
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
7575
const unsigned long timeoutSet = 120; //sec
76-
const unsigned long timeoutTempFn = 5; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v5-6tube-rotary.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7373

7474
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
7575
const unsigned long timeoutSet = 120; //sec
76-
const unsigned long timeoutTempFn = 5; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v5-6tube.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7373

7474
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
7575
const unsigned long timeoutSet = 120; //sec
76-
const unsigned long timeoutTempFn = 5; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v8-4tube.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7979

8080
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
8181
const unsigned long timeoutSet = 120; //sec
82-
const unsigned long timeoutTempFn = 5; //sec
82+
const unsigned long timeoutTempFn = 5; //sec
83+
84+
//This clock is 2x3 multiplexed: two tubes powered at a time.
85+
//The anode channel determines which two tubes are powered,
86+
//and the two SN74141 cathode driver chips determine which digits are lit.
87+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
88+
const char outA1 = 2;
89+
const char outA2 = 3;
90+
const char outA3 = 4;
91+
const char outA4 = 5;
92+
const char outB1 = 6;
93+
const char outB2 = 7;
94+
const char outB3 = 8;
95+
const char outB4 = 9;
96+
//3 pins out to anode channel switches
97+
const char anode1 = 11;
98+
const char anode2 = 12;
99+
const char anode3 = 13;

sixtube_lm/configs/v8-6tube.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7979

8080
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
8181
const unsigned long timeoutSet = 120; //sec
82-
const unsigned long timeoutTempFn = 5; //sec
82+
const unsigned long timeoutTempFn = 5; //sec
83+
84+
//This clock is 2x3 multiplexed: two tubes powered at a time.
85+
//The anode channel determines which two tubes are powered,
86+
//and the two SN74141 cathode driver chips determine which digits are lit.
87+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
88+
const char outA1 = 2;
89+
const char outA2 = 3;
90+
const char outA3 = 4;
91+
const char outA4 = 5;
92+
const char outB1 = 6;
93+
const char outB2 = 7;
94+
const char outB3 = 8;
95+
const char outB4 = 9;
96+
//3 pins out to anode channel switches
97+
const char anode1 = 11;
98+
const char anode2 = 12;
99+
const char anode3 = 13;

sixtube_lm/configs/v8a-6tube-relayswitch.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ const byte enableSoftPowerSwitch = 1; //works with switched relay only
5959
// 1 = yes. Relay can be switched on and off directly when clock is displaying time of day (fnIsTime). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).
6060
// 0 = no. Use if the connected appliance has its own power switch (independent of this relay circuit) or does not need to be manually switched.
6161

62-
//LED circuit control
63-
const char ledPin = A2;
64-
// -1 to disable feature; A2 if equipped (UNDB v8)
62+
//LED circuit control with PWM
63+
const char ledPin = 11;
64+
// -1 to disable feature; 11 if equipped (UNDB v8 modded)
6565

6666
//When display is dim/off, a press will light the tubes for how long?
6767
const byte unoffDur = 10; //sec
@@ -79,4 +79,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7979

8080
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
8181
const unsigned long timeoutSet = 120; //sec
82-
const unsigned long timeoutTempFn = 5; //sec
82+
const unsigned long timeoutTempFn = 5; //sec
83+
84+
//This clock is 2x3 multiplexed: two tubes powered at a time.
85+
//The anode channel determines which two tubes are powered,
86+
//and the two SN74141 cathode driver chips determine which digits are lit.
87+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
88+
const char outA1 = 2;
89+
const char outA2 = 3;
90+
const char outA3 = 4;
91+
const char outA4 = 5;
92+
const char outB1 = 6;
93+
const char outB2 = 7;
94+
const char outB3 = 8;
95+
const char outB4 = 9;
96+
//3 pins out to anode channel switches
97+
const char anode1 = 16; //A2
98+
const char anode2 = 12;
99+
const char anode3 = 13;

sixtube_lm/configs/v8b-6tube-relayswitch.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ const byte enableSoftPowerSwitch = 1; //works with switched relay only
5959
// 1 = yes. Relay can be switched on and off directly when clock is displaying time of day (fnIsTime). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).
6060
// 0 = no. Use if the connected appliance has its own power switch (independent of this relay circuit) or does not need to be manually switched.
6161

62-
//LED circuit control
63-
const char ledPin = A2;
64-
// -1 to disable feature; A2 if equipped (UNDB v8)
62+
//LED circuit control with PWM
63+
const char ledPin = 11;
64+
// -1 to disable feature; 11 if equipped (UNDB v8 modded)
6565

6666
//When display is dim/off, a press will light the tubes for how long?
6767
const byte unoffDur = 10; //sec
@@ -79,4 +79,21 @@ const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to giv
7979

8080
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
8181
const unsigned long timeoutSet = 120; //sec
82-
const unsigned long timeoutTempFn = 5; //sec
82+
const unsigned long timeoutTempFn = 5; //sec
83+
84+
//This clock is 2x3 multiplexed: two tubes powered at a time.
85+
//The anode channel determines which two tubes are powered,
86+
//and the two SN74141 cathode driver chips determine which digits are lit.
87+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
88+
const char outA1 = 2;
89+
const char outA2 = 3;
90+
const char outA3 = 4;
91+
const char outA4 = 5;
92+
const char outB1 = 6;
93+
const char outB2 = 7;
94+
const char outB3 = 8;
95+
const char outB4 = 9;
96+
//3 pins out to anode channel switches
97+
const char anode1 = 16; //A2
98+
const char anode2 = 12;
99+
const char anode3 = 13;

sixtube_lm/sixtube_lm.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,10 +1004,10 @@ void startScroll() { //To scroll a value in, call this after calling editDisplay
10041004
//The anode channel determines which two tubes are powered,
10051005
//and the two SN74141 cathode driver chips determine which digits are lit.
10061006
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
1007-
byte binOutA[4] = {2,3,4,5};
1008-
byte binOutB[4] = {6,7,8,9};
1007+
byte binOutA[4] = {outA1,outA2,outA3,outA4};
1008+
byte binOutB[4] = {outB1,outB2,outB3,outB4};
10091009
//3 pins out to anode channel switches
1010-
byte anodes[3] = {11,12,13};
1010+
byte anodes[3] = {anode1,anode2,anode3};
10111011

10121012
const int fadeDur = 5; //ms - each multiplexed pair of digits appears for this amount of time per cycle
10131013
const int dimDur = 4; //ms - portion of fadeDur that is left dark during dim times

v8a_mod_test/v8a_mod_test.ino

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
//For testing mods to the v8.0 board, style A, with LED PWM
2+
3+
const byte btnSel = A1; //was A1
4+
const byte btnAlt = A0; //was A0
5+
const byte btnUp = A6; //was A2
6+
const byte btnDn = A7; //was A3
7+
const byte pinLED = 11; //was A6
8+
const byte pinRelay = A3; //was A7
9+
byte binOutA[4] = {2,3,4,5};
10+
byte binOutB[4] = {6,7,8,9};
11+
byte anodes[3] = {16,12,13}; //first was 11
12+
13+
byte btnCur = 0; //Momentary button currently in use - only one allowed at a time
14+
15+
byte ledStateNow = 0;
16+
byte ledStateTarget = 0;
17+
18+
void setup(){
19+
Serial.begin(9600);
20+
//0 and 1: set as digital input
21+
pinMode(A0, INPUT_PULLUP);
22+
pinMode(A1, INPUT_PULLUP);
23+
//2 and 3: set as digital output
24+
pinMode(A2, OUTPUT);
25+
pinMode(A3, OUTPUT);
26+
//4 and 5: for I2C
27+
//6 and 7: input, but analog pins with hardware pullup resistors, so nothing to do
28+
analogWrite(pinLED,0); //0 = LEDs off
29+
digitalWrite(pinRelay,1); //1 = connected device off
30+
31+
//Set up just enough tube output to confirm the changed first anode is working
32+
for(byte i=0; i<4; i++) { pinMode(binOutA[i],OUTPUT); pinMode(binOutB[i],OUTPUT); digitalWrite(binOutA[i],LOW); digitalWrite(binOutB[i],LOW); }
33+
for(byte i=0; i<3; i++) { pinMode(anodes[i],OUTPUT); digitalWrite(anodes[i],LOW); }
34+
digitalWrite(anodes[0],HIGH); //the one we want to test
35+
36+
Serial.println();
37+
Serial.println(F("Ready for input."));
38+
Serial.println(F("Display should now read 0 on 3rd and 6th tubes."));
39+
Serial.println(F("SEL should change them to a 1; ALT should change them to 2."));
40+
Serial.println(F("UP should fade the LEDs in and out."));
41+
Serial.println(F("DOWN should toggle the relay."));
42+
}
43+
44+
void loop(){
45+
checkInputs();
46+
if(ledStateNow != ledStateTarget) {
47+
if(ledStateNow > ledStateTarget) { ledStateNow -= 5; }
48+
else if(ledStateNow < ledStateTarget) { ledStateNow += 5; }
49+
// Serial.print(ledStateNow,DEC);
50+
// Serial.print(F(" => "));
51+
// Serial.println(ledStateTarget,DEC);
52+
analogWrite(pinLED,ledStateNow);
53+
}
54+
delay(5); //in case of switch bounce?
55+
}
56+
57+
void checkInputs(){
58+
checkBtn(btnSel);
59+
checkBtn(btnAlt);
60+
checkBtn(btnUp);
61+
checkBtn(btnDn);
62+
}
63+
bool readInput(byte pin){
64+
if(pin==A6 || pin==A7) return analogRead(pin)<100?0:1; //analog-only pins
65+
else return digitalRead(pin);
66+
}
67+
void checkBtn(byte btn){
68+
//Changes in momentary buttons, LOW = pressed.
69+
//When a button event has occurred, will call ctrlEvt
70+
bool bnow = readInput(btn);
71+
//If the button has just been pressed, and no other buttons are in use...
72+
if(btnCur==0 && bnow==LOW) {
73+
btnCur = btn;
74+
Serial.println();
75+
bool newState = LOW;
76+
switch(btn) {
77+
case btnSel:
78+
Serial.println(F("btnSel pressed"));
79+
digitalWrite(binOutA[0],HIGH);
80+
digitalWrite(binOutA[1],LOW);
81+
digitalWrite(binOutB[0],HIGH);
82+
digitalWrite(binOutB[1],LOW);
83+
break;
84+
case btnAlt:
85+
Serial.println(F("btnAlt pressed"));
86+
digitalWrite(binOutA[0],LOW);
87+
digitalWrite(binOutA[1],HIGH);
88+
digitalWrite(binOutB[0],LOW);
89+
digitalWrite(binOutB[1],HIGH);
90+
break;
91+
case btnUp:
92+
Serial.println(F("btnUp pressed"));
93+
ledStateTarget = (ledStateTarget==0?255:0);
94+
Serial.println();
95+
if(ledStateTarget==0) Serial.println(F("LED switched off. LED PWM pin should fade to open circuit."));
96+
else Serial.println(F("LED switched on. LED PWM pin should fade to closed circuit."));
97+
break;
98+
case btnDn:
99+
Serial.println(F("btnDn pressed"));
100+
newState = !digitalRead(pinRelay);
101+
digitalWrite(pinRelay, newState);
102+
Serial.println();
103+
if(newState) Serial.println(F("Relay switched on. Relay pins should measure open circuit now (connected device off)."));
104+
else Serial.println(F("Relay switched off. Relay pins should measure closed circuit now (connected device on)."));
105+
break;
106+
default: break;
107+
} //end button printing switch
108+
} //end if button presed
109+
//If the button has just been released...
110+
if(btnCur==btn && bnow==HIGH) {
111+
btnCur = 0;
112+
}
113+
}

0 commit comments

Comments
 (0)