michaelvdheijden

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Turn tubes off at night #36931

    michaelvdheijden
    Participant

    @Johan,

    Take a look at this code. Here you can find exactly what you need for your board! 😉 (Code added by Vasques666).

    The most of the fading code is found in the top of the “doIndication818.ino” file. Compare this with you standard firmware file and add the changes to yours.
    In the “doIndication818.h” only one line needs to be changed:
    const unsigned int fpsLimit=1000;

    In the “NixieclockNCT818.ino” file some things are added search for:

    const int TimeToSleep = 21;
    const int TimeToWake = 8;
    
    static String prevstringToDisplay = "000000";
    
    prevstringToDisplay = PreZero(hour()) + PreZero(minute()) + PreZero(second()-1);

    Hope this will help you.

    I see you are dutch, maybe you can take a look at this page here I explained some more detailes on the problem I have.
    Maybe we can get in touch with each other through that forum so we can take a look at my code.

    Thanks!

    Greetings.

    in reply to: Turn tubes off at night #36700

    michaelvdheijden
    Participant

    Hi Vasques or someone else,

    I compared the firmware from your NCM107&NCT3XX and mine NCS314 Shield. I have everything compared / copied and implemented for the fading. But it’s not working properly.

    I think the problem lays in the differents in the drivers:

    NCT818 (registers HV5122) 32-Channel, Serial-to-Parallel Converter with Open-Drain Outputs
    NCS314 (registers HV57708) 64-Channel 32-MHz Serial-to-Parallel Converter with Push-Pull Outputs.

    In the “doindication” files the SPI output is different. I think because the NCT818 needs to be writen once and the NCS314 twise?

    Here the parts that are NOT the same:
    NCT818:

    
    //-------- REG 1 ----------------------------------------------- 
      Var32=0;
     
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(5)&blankDigit(2))<<20; // s2
      digits=digits/10;
    
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(4)&blankDigit(3))<<10; //s1
      digits=digits/10;
    
      Var32|=(unsigned long) (SymbolArray[digits%10]&doEditBlink(3)&blankDigit(4)); //m2
      digits=digits/10;
    
      if (LD) Var32&=~LowerDotsMask;
        else  Var32|=LowerDotsMask;
      
      if (UD) Var32&=~UpperDotsMask; 
        else  Var32|=UpperDotsMask; 
    
      SPI.transfer(Var32>>24);
      SPI.transfer(Var32>>16);
      SPI.transfer(Var32>>8);
      SPI.transfer(Var32);
    
     //-------------------------------------------------------------------------
    
     //-------- REG 0 ----------------------------------------------- 
      Var32=0;
      
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(2)&blankDigit(5))<<20; // m1
      digits=digits/10;
    
      Var32|= (unsigned long)(SymbolArray[digits%10]&doEditBlink(1)&blankDigit(6))<<10; //h2
      digits=digits/10;
    
      Var32|= (unsigned long)SymbolArray[digits%10]&doEditBlink(0)&blankDigit(7); //h1
      digits=digits/10;
    
      if (LD) Var32&=~LowerDotsMask;  
        else  Var32|=LowerDotsMask;
      
      if (UD) Var32&=~UpperDotsMask; 
        else  Var32|=UpperDotsMask; 
         
      SPI.transfer(Var32>>24);
      SPI.transfer(Var32>>16);
      SPI.transfer(Var32>>8);
      SPI.transfer(Var32);
      if ((hour() < TimeToSleep) & (hour() >= TimeToWake))
    //  if (!light)
      {
        digitalWrite(LEpin, HIGH);
      } else {    
        if ((counter2 % SleepDim) == 0) digitalWrite(LEpin, HIGH);   
      }
    //-------------------------------------------------------------------------
    

    NCS314:

    
    //-------- REG 1 ----------------------------------------------- 
      Var32=0;
     
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(5))<<20; // s2
      digits=digits/10;
    
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(4))<<10; //s1
      digits=digits/10;
    
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(3)); //m2
      digits=digits/10;
    
      if (LD) Var32|=LowerDotsMask;
        else  Var32&=~LowerDotsMask;
      
      if (UD) Var32|=UpperDotsMask;
        else Var32&=~UpperDotsMask;  
    
      for (int i=1; i<=32; i++)
      {
       i=i+32;
       int newindex=16*(3-(ceil((float)i/4)*4-i))+ceil((float)i/4); 
       i=i-32;
       /*Serial.print("i=");
       Serial.print(i);
       Serial.print(" newindex=");
       Serial.println(newindex);*/
       if (newindex<=32) bitWrite(New32_L, newindex-1, bitRead(Var32, i-1));
        else bitWrite(New32_H, newindex-32-1, bitRead(Var32, i-1));
      }
     //-------------------------------------------------------------------------
    
     //-------- REG 0 ----------------------------------------------- 
      Var32=0;
      
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(2))<<20; // m1
      digits=digits/10;
    
      Var32|= (unsigned long)(SymbolArray[digits%10]&doEditBlink(1))<<10; //h2
      digits=digits/10;
    
      Var32|= (unsigned long)SymbolArray[digits%10]&doEditBlink(0); //h1
      digits=digits/10;
    
      if (LD) Var32|=LowerDotsMask;
        else  Var32&=~LowerDotsMask;
      
      if (UD) Var32|=UpperDotsMask;
        else Var32&=~UpperDotsMask;  
    
      for (int i=1; i<=32; i++)
      {
       int newindex=16*(3-(ceil((float)i/4)*4-i))+ceil((float)i/4); 
       if (newindex<=32) bitWrite(New32_L, newindex-1, bitRead(Var32, i-1));
        else bitWrite(New32_H, newindex-32-1, bitRead(Var32, i-1));
      }
    
      SPI.transfer((New32_H)>>24);
      SPI.transfer((New32_H)>>16);
      SPI.transfer((New32_H)>>8);
      SPI.transfer(New32_H);
      
      SPI.transfer((New32_L)>>24);
      SPI.transfer((New32_L)>>16);
      SPI.transfer((New32_L)>>8);
      SPI.transfer(New32_L);
    
      digitalWrite(LEpin, HIGH); //<<-- это правильно H -> L
      digitalWrite(LEpin, LOW); // <<-- это правильно H -> L
    //-------------------------------------------------------------------------
    

    Pasting the NCT818 to NCS314 results in perfect fading but no logical orders. The numers jump from left to right in random order.

    Can somebody help in adjusting this SPI output so it can work on the NCS314 with the HV57708?

    Thank you very much!

    in reply to: Turn tubes off at night #36273

    michaelvdheijden
    Participant

    Hi Vasques,

    Would you like to paste the code that needs to be added to get crossfade for digits?

    I really would like that option.

    I have a NCS314 shield.

    Thanks!

    Greetings Brutus.

Viewing 3 posts - 1 through 3 (of 3 total)