I tried cleaning up the code a little and accounting for the unused bits 
corresponding to the unoccupied high volage outputs corresponding to each 
HV chip, but it still doesn't work as intended. I feel like im crawling 
closer but i'm sure im making a big noob mistake:

#define PIN_LE    10 //Shift Register Latch Enable
#define PIN_CLK   13  //Shift Register Clock
#define PIN_DATA  11  //Shift Register Data
#define PIN_BL    9  //Shift Register Blank (0=display off     1=display on)


// shift register positions
// --------------------------HV5530 #1--------------------------
// Controls 9 Dots (One cathode each), Plus/Minus tube (2 cathodes), One 10 
digit tube (10 cathodes)

// Dots are first
//      Dot   1  2  3  4  5  6  7  8  9
int dots[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};

//HV5530 #1 Pin 10 (HVOUT20) is not used
//Bit 9 not used
int blank1[] = {9};
// Plus/minus tube  +   -
int plusminus[] = {10, 11};

// Rightmost numeric tube (Tube 1)
//        Digit  0   1   2   3   4   5   6   7   8   9
//  NL840 Pin #  13  5   7   10  6   2   8   1   3   9 
int tube1[] =  {15, 16, 18, 21, 17, 13, 19, 12, 14, 20};          
//Pins 35-44 (HVOUT1 - HVOUT10) are not used
int blank2[] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
// --------------------------HV5530 #2,3,4--------------------------
//HV5530#2,3,4 each control three (3) numeric tubes each (10 cathodes each, 
30 cathodes total)
//Connections are similarly numbered between each set of tubes and HV chip 
for chips 2,3,4
//Pins 21 and 22 (HVOUT31 and HVOUT32) are not used

// Next 3 tubes from right to left (Tubes 2,3,4)
//       Digit  0   1   2   3   4   5   6   7   8   9
// NL840 Pin #  13  5   7   10  6   2   8   1   3   9 
int tube2[] =  {35, 36, 38, 41, 37, 33, 39, 32, 34, 40};
int tube3[] =  {45, 46, 48, 51, 47, 43, 49, 42, 44, 50}; 
int blank3[] = {52 , 53};
int tube4[] =  {57,  58, 60, 63, 59, 55, 61, 54, 56, 62};  

//       Digit  0   1   2   3   4   5   6   7   8   9
// NL840 Pin #  13  5   7   10  6   2   8   1   3   9 
int tube5[] =  {67, 68, 70, 73, 69, 65, 71, 64, 66, 72};
int tube6[] =  {77,  78, 80, 83, 79, 75, 81, 74, 76, 82};
int blank4[] = {84 , 85};
int tube7[] =  {89,  90, 92, 95, 91, 87, 93, 86, 88, 94}; 

//       Digit  0   1   2   3   4   5   6   7   8   9
// NL840 Pin #  13  5   7   10  6   2   8   1   3   9 
int tube8[] =  {99,100,102,105,101,97,103,96,98,104};
int tube9[] =  {109,110,112,115,111,107,113,106,108,114};  
int blank5[] = {116 , 117};
int tube10[] =  {121,122,124,127,123,119,125,118,120,126}; 


void setup() {
  pinMode(PIN_LE,  OUTPUT);
  pinMode(PIN_BL,  OUTPUT);
  pinMode(PIN_DATA,OUTPUT);
  pinMode(PIN_CLK, OUTPUT);
  digitalWrite(PIN_BL, HIGH);
  BlankDisplay();
}


unsigned long previousSRMillis = 0;    // keeping track last time shift 
register values were clocked in

void loop() {
  boolean srBuffer[128] = {0};
  unsigned long currentMillis = millis();
  
  if (currentMillis - previousSRMillis >= 250) {  // clocking in 4 times a 
second
    
    previousSRMillis = currentMillis;

    boolean srBuffer[128] = {0};

    // doing the lookups for what number to display then
    // looking up which shift register position
    // for each tube
    // "10" from the lookup table indicates to blank the tube since it is 
out of range.
    
    srBuffer[dots[1]] = 1; //light up dot 1
    srBuffer[blank1[1]] = 0; //unused output on HV5530 #1 (pin 10)
    srBuffer[plusminus[1]] = 1; //light up plus
    srBuffer[tube1[1]] = 1; //light up number 1 on tube 1
    srBuffer[blank2[1,2,3,4,5,6,7,8,9,10]] = 0; //unused outputs on HV5530 
#1 (pins 35-44)
    srBuffer[tube2[2]] = 1; //light up number 2 on tube 2
    srBuffer[tube3[1]] = 1; //light up number 1 on tube 3
    srBuffer[blank3[1,2]] = 0; //unused outputs on HV5530 #2 (pins 21-22)
    srBuffer[tube4[2]] = 1; //light up number 2 on tube 4
    srBuffer[tube5[1]] = 1; //light up number 1 on tube 5
    srBuffer[tube6[2]] = 1; //light up number 2 on tube 6
    srBuffer[blank4[1,2]] = 0; //unused outputs on HV5530 #3 (pins 21-22)
    srBuffer[tube7[1]] = 1; //light up number 1 on tube 7
    srBuffer[tube8[2]] = 1; //light up number 2 on tube 8
    srBuffer[tube9[1]] = 1; //light up number 1 on tube 9
    srBuffer[blank5[1,2]] = 0; //unused outputs on HV5530 #4 (pins 21-22)
    srBuffer[tube10[2]] = 1; //light up number 2 on tube 10


    digitalWrite(PIN_LE, LOW);

    for(int i = 0; i < 128; i++){ 
      
      digitalWrite(PIN_DATA,srBuffer[i]);
      digitalWrite(PIN_CLK,HIGH);
      delayMicroseconds(5);
      digitalWrite(PIN_CLK,LOW);
      delayMicroseconds(5);
    }

    digitalWrite(PIN_LE, HIGH);
  }

}


void BlankDisplay()
{
  // Disconnect shift register from data latches:
  digitalWrite(PIN_LE, LOW);


  // Set the data to LOW
  digitalWrite  (PIN_DATA,  LOW);


  //  Clock in the LOW 128 times
  for (uint8_t i = 0; i < 128; i++)
  {
    digitalWrite(PIN_CLK, LOW);   // Clock in one data bit
    digitalWrite(PIN_CLK, HIGH);
  }
}



On Sunday, October 7, 2018 at 8:13:46 PM UTC-4, Kevin A. wrote:
>
> Also, I have a discussion going on in the Arduino forums, since I also 
> think this is a good place for such a discussion: 
> https://forum.arduino.cc/index.php?topic=571891.0
>
> On Friday, October 5, 2018 at 3:48:33 PM UTC-4, gregebert wrote:
>>
>> I'm starting a separate thread on this topic that was posted from the 
>> introduction discussion
>>
>> As with any serial shift-register, the biggest source of trouble is 
>> timing-related, such as not accounting for setup and hold-time requirements.
>>
>> *First question*: Are you able to get reliable and predictable data into 
>> the first HV5530 that is connected to your controller ? If not, then the 
>> entire shift chain will be broken, aka "garbage-in, garbage out".
>> This needs to be solved first. I took a quick look at the code that was 
>> posted and did not see any obvious issues, so I think your setup/hold 
>> timing getting into the first HV5530 is correct.
>>
>> Do you have level-shifters between your controller and the HV5530 ? The 
>> logic portion of the HV5530 is intended to operate at 12V, whereas most 
>> controller devices have 3.3V logic levels.
>> If you dont have a level-shifter, then you are operating outside the 
>> device spec and you venturing into a jungle of unpredicatbles and 
>> uncontrollables.
>> I know some neonixie members have posted about their good results with 
>> HVxxxx devices operated outside of spec, so if you are adventurous then go 
>> for it.
>>
>> All I can say, based on my own experience, is that when you are not 
>> datasheet compliant, expect trouble. I had 3 completely unrelated problems 
>> with a 16-channel A/D converter on my current project, and all of them 
>> turned out to be either my misinterpretation of the datasheet, or my 
>> failure to pay attention to a detail in the datasheet. Once I got those 
>> corrected, it's been fine ever since.
>>
>> *Second question*: If the first HV5530 is operating as expected, what 
>> about the next one in the chain ?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neonixie-l+unsubscr...@googlegroups.com.
To post to this group, send an email to neonixie-l@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/neonixie-l/47d18aeb-464d-4480-a3b0-31d2c4ad95ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to