afch / NixeTubesShieldNCS314

Firmware (Sketch) for Arduino UNO/MEGA and GRA & AFCH Nixie Tubes Shield NCS314-4 Tubes, NCS314-6 Tubes and NCS312-6 Tubes by GRA & AFCH
https://www.gra-afch.com
57 stars 51 forks source link

Firmware for NCS312 v1.5? #24

Open zen85 opened 3 years ago

zen85 commented 3 years ago

Hello!

I just got the NCS312 v1.5 and i tried severall firmwares for it since there is none dedicated to v1.5. But they show the wrong values. I tried with a mega and with an uno. the behaviour is the same. iE when i use the following code:

//NIXIE CLOCK SHIELD NCS314 v 2.x by GRA & AFCH (fominalec@gmail.com)
//1 26.06.2018
//Simple code for HV5122PJ-G Hihg Voltage registers

#include <SPI.h>

const byte LEpin=10; //pin Latch Enabled data accepted while HI level

String stringToDisplay="000000";// Conten of this string will be displayed on tubes (must be 6 chars length)

//                            0      1      2      3      4      5      6      7      8       9
unsigned int SymbolArray[10]={1,     2,     4,     8,     16,    32,    64,    128,   256,    512};

/*******************************************************************************************************
Init Programm
*******************************************************************************************************/
void setup() 
{

  Serial.begin(115200);
  Serial.println(F("Starting"));

  pinMode(LEpin, OUTPUT);

 // SPI setup
  SPI.begin(); // 
  SPI.setDataMode (SPI_MODE2); // Mode 2 SPI
  SPI.setClockDivider(SPI_CLOCK_DIV8); // SCK = 16MHz/8= 2MHz

}

/***************************************************************************************************************
MAIN Programm
***************************************************************************************************************/
void loop() {
  stringToDisplay="123456";
  Serial.println(stringToDisplay);
  doIndication();
  delay(3000);
  stringToDisplay="222222";
  Serial.println(stringToDisplay);
  doIndication();
  delay(3000);
}

void doIndication()
{
  digitalWrite(LEpin, LOW);    // allow data input (Transparent mode)
  unsigned long Var32=0;

  long digits=stringToDisplay.toInt();

  //-------- REG 1 ----------------------------------------------- 
  Var32=0;

  Var32|=(unsigned long)(SymbolArray[digits%10])<<20; // s2
  digits=digits/10;

  Var32|=(unsigned long)(SymbolArray[digits%10])<<10; //s1
  digits=digits/10;

  Var32|=(unsigned long) (SymbolArray[digits%10]); //m2
  digits=digits/10;

  SPI.transfer(Var32>>24);
  SPI.transfer(Var32>>16);
  SPI.transfer(Var32>>8);
  SPI.transfer(Var32);

  //digitalWrite(LEpin, LOW);   
 //-------------------------------------------------------------------------

 //-------- REG 0 ----------------------------------------------- 
  Var32=0;

  Var32|=(unsigned long)(SymbolArray[digits%10])<<20; // m1
  digits=digits/10;

  Var32|= (unsigned long)(SymbolArray[digits%10])<<10; //h2
  digits=digits/10;

  Var32|= (unsigned long)SymbolArray[digits%10]; //h1
  digits=digits/10;

  //digitalWrite(LEpin, HIGH);

  SPI.transfer(Var32>>24);
  SPI.transfer(Var32>>16);
  SPI.transfer(Var32>>8);
  SPI.transfer(Var32);

  digitalWrite(LEpin, HIGH);     // latching data 
}

i get "999999" instead of "222222" and "89._t567" instead of "123456"

which firmware should i use?

esegege commented 3 years ago

Hi, I have the same problem, do you solve it?

sdonogh commented 3 years ago

I have the same issue

esegege commented 3 years ago

I didnt found firmware for v 1.5, the developer said that the Firmware for this Model have merged with the NCS314 Repository.

grnbrg commented 2 years ago

I received an NCS312 v1.5 (14/08/2020) pre-built shield today. I was able to compile and flash an Arduino Mega with firmware based on the source at NixeTubesShieldNCS314/Firmware/Source code/Hardware Version 2.0 (HW2.0)/.

So it is possible. I haven't had much of a chance to do much testing, but it appears to work as expected. My only (minor) issue is that the buzzer is much louder than I'd like. Hopefully I can find some way to make it quieter in software, or I may have to just desolder it from the board....

h3xcat commented 2 years ago

Not all firmwares are compatible, as there are some that use different pin assignments and chip components. Schematics for NCS312V1 and NCS314V2 do appear to be identical. As long as they use the same pin assignments and components, I don't see any issues with swapping the firmware.

https://gra-afch.com/category/downloads/schemes/shields/

I found these schematics quite useful for converting my own custom firmware to NCS318 from NCS314.

grnbrg commented 2 years ago

Yes, I spent a fair amount of time reviewing the schematics and examining the board before settling on the 314v2.0 source. In the newer hardware versions, the two main tube drivers have been consolidated into a single large chip, so the 3.x tree was a non-starter. The clock has been set, and is keeping time, the thermometer is reasonably accurate and the GPS time source is working.

I thought I'd report my success, as I am not the only one who was not entirely sure what code and/or firmware version to use on the latest hardware revision, since there is almost no mention anywhere of NCS312v1.5.... The short answer is that the NCS314v2.0 firmware (fw version 1.94) appears to work. My plans are to eventually drive the shield with an ESP32, and add an FM radio module. I expect to use the provided code more or less as a library to light the tubes based on my own code, in a DIY clock radio with all the features I've wanted, but never been able to find. :)