looking for demo code for Arduino nano to talk to 4 TPIC6B595's 7-seg display

i decided to go for it..a learning process, rather than buying a ready made board or kit.
i built me a 4 digit 7-seg display..2.3" tall
i am looking for some demo code to try, to see that i have the display built correctly.
i'm not 100% sure which digit should get the SER input.. the far right or far left digit..

a simple count up code would be fine 0-9999 some thing faster then 1 sec per count..lol
maybe 4 or 5 CPS ?

Large digit driver board here.
The page has all the info and example code.
Leo..

i had looked at that, but it is only for 2 digits,,and mine is 4 digits...

number %= 100; //Reset x after 99

number %= 1000; //Reset x after 999

number %= 1000; //Reset x after 9999

so that's the only part i'd have to change in the code.. ok,, i'll try it..

If you also change delay(500) to delay(50) or so,
then you don't have to wait ages to reach 9999.
Leo..

cardinalflyer >> thanks.. i already have one of these boards working in a GPS clock, 6 digits 10" tall..
works great. but i took it apon myself to build me a smaller unit that i will later be turning into
a 4 digit thermometer, using a DHT22 sensor.
i wanted the experience to build my own driver board. it was not nearly as hard as i had thought it to be.

i just wanted some test code to make sure display was working correctly 1st..
i still am unclear as to which digit gets the serial input 1st. the far right or far left..
i guess i'll fine out when i test it..

Dacflyer:
i still am unclear as to which digit gets the serial input 1st. the far right or far left..
i guess i'll fine out when i test it..

The first byte you shift in will end up in the last chip of the string.
Leo..

hi again.. i looked at the hook up diagram sparksfun was using.. i am assuming the pin out is the same on the nano's

i'm double checking my connections, but i get nothing on display...i'll check it more tomorrow..

also i have a UNO, it's acting weird.. i can burn the sketch onto the UNO, and the TX led blinks, letting me know
it is working.. but if i unplug it,, it looses it's memory.. i go to plug it back in and it just sits there and does nothing..but if i start serial monitor, it comes to life and counts...any ideas ? defective cpu ?

the nano works every time i plug it in..

i'm gonna work on display more tomorrow...

Wawa:
The first byte you shift in will end up in the last chip of the string.
Leo..

ok, i got it now..

defective cpu ?

No.
This is a common complaint and it is never justified. It simply does not happen like you describe. Eventually you find out what has gone wrong and you are too embarrassed to come back and say what it was.

That is what normally happens.

ok, i borrowed a friends UNO.. it burned just fine.. but mine still does it.. once power is removed, it goes dumb.. i burned them both back to back.. his works fine, mine doesn't..
but my nano is ok,,

once power is removed, it goes dumb

The program memory is flash memory. you do not wipe it by removing the power, that is the whole point about flash memory.

what could it be then ? defective UNO ?
programming 2 back to back,, one saves the sketch, the other won't boot after power removed..

Grumpy_Mike:
No.
This is a common complaint and it is never justified. It simply does not happen like you describe. Eventually you find out what has gone wrong and you are too embarrassed to come back and say what it was.

That is what normally happens.

hey Grumpy.. i am a newbie, as you can tell, but i am here to tell you i ain't afraid to admit my mistakes. i am learning after all.. but no i am not embarrassed to let ya know it either...
as far as i had figured out with my UNO.. for some reason the program i had on it was looking for serial interaction to make it function. why i do not know.. i didn't write the code, it was something i borrowed,, and my nano didn't care either way... so if you know more, then maybe, you can be NOT so GRUMPY, and help a fella.


NEXT,

OK, i got code working for my project, it seems to be working ok so far, except the temperature has a leading zero, ( 075.2 ) and there is no decimal point either. so my display shows 0752. and, it does not display a negative symbol for the neg. temperatures.. so i am trying to figure that part out...
stay tuned, or feel or if anyone can help.
thanks..

We haven't seen any code, diagram, or pictures yet.

A leading zero can be removed with code.
A negative sign can be added with code.
A decimal point can be added with code, or with a permanent current limiting resistor from the dot segment to ground.
Look at the datasheet for Vf of that dot. It could be a single LED, unlike the other segments.
Leo..

.. so if you know more, then maybe, you can be NOT so GRUMPY, and help a fella.

I thought I did help by telling you what you thought was wrong and could not happen.
Without my trusty crystal ball which is currently out for repair it is the best anyone can do. I had assumed you knew what your code was doing because it was your code.

The quality of the answer can only be as good as the quality of the question.

nope it wasn't MY code, it was bits and pieces i found here and there...

i'll post the code i have later on today when i get home..

WaWa >>>
i am going to try to attach my code here.. i don't see how to attach it as a file.. so i am going to copy and paste it here..

the code is not of my doing, a friend started helping me, but went on vacation. i only modified part of the code so that my display would work.
as i stated earlier, i need the function of negative symbol for temps below zero, and the leading zero needs to be blanked, and i think i will hard wire the DP..

thanks for any help..


#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define DHTPIN     2       // Pin connected to DHT22 sensor
#define DHTTYPE    DHT22

DHT_Unified dht(DHTPIN, DHTTYPE);

uint32_t delayMS;

//GPIO declarations
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
byte segmentClock = 6;
byte segmentLatch = 5;
byte segmentData = 7;

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

void setup()
{
sensor_t sensor;

  pinMode(segmentClock, OUTPUT);
  pinMode(segmentData, OUTPUT);
  pinMode(segmentLatch, OUTPUT);

  digitalWrite(segmentClock, LOW);
  digitalWrite(segmentData, LOW);
  digitalWrite(segmentLatch, LOW);

  // Initialize device
  dht.begin();
  dht.temperature().getSensor(&sensor);
  delayMS = sensor.min_delay / 2000;
}

//Takes a number and displays 2 numbers. Displays absolute value (no negatives)
void showNumber(float value)
{
  int number = abs(value); //Remove negative signs and any decimals

  //Serial.print("number: ");
  //Serial.println(number);

  for (byte x = 0 ; x < 4 ; x++)
  {
    int remainder = number % 10;
    postNumber(remainder, false);
    number /= 10;
  }

  //Latch the current segment data
  digitalWrite(segmentLatch, LOW);
  digitalWrite(segmentLatch, HIGH); //Register moves storage register on the rising edge of RCK
}

//Given a number, or '-', shifts it out to the display
void postNumber(byte number, boolean decimal)
{
  //    -  A
  //   / / F/B
  //    -  G
  //   / / E/C
  //    -. D/DP

#define a  1<<0
#define b  1<<1
#define c  1<<2
#define d  1<<3
#define e  1<<4
#define f  1<<5
#define g  1<<6
#define dp 1<<7

  byte segments;

  switch (number)
  {
    case 1: segments = b | c; break;
    case 2: segments = a | b | d | e | g; break;
    case 3: segments = a | b | c | d | g; break;
    case 4: segments = f | g | b | c; break;
    case 5: segments = a | f | g | c | d; break;
    case 6: segments = a | f | g | e | c | d; break;
    case 7: segments = a | b | c; break;
    case 8: segments = a | b | c | d | e | f | g; break;
    case 9: segments = a | b | c | d | f | g; break;
    case 0: segments = a | b | c | d | e | f; break;
    case ' ': segments = 0; break;
    case 'c': segments = g | e | d; break;
    case '-': segments = g; break;
  }

  if (decimal) segments |= dp;

  //Clock these bits out to the drivers
  for (byte x = 0 ; x < 8 ; x++)
  {
    digitalWrite(segmentClock, LOW);
    digitalWrite(segmentData, segments & 1 << (7 - x));
    digitalWrite(segmentClock, HIGH); //Data transfers to the register on the rising edge of SRCK
  }
}

void loop()
{
  sensors_event_t event;
  int16_t number;

  delay(delayMS);

  dht.temperature().getEvent(&event);
  if (!isnan(event.temperature)) {
   showNumber(((event.temperature * 90) / 5) + 320);
  }
}

Please use the code tag button next time, </> on the menu.