Go Down

Topic: 4 DIGIT 12V 7 SEGMENT DISPLAY (Read 12587 times) previous topic - next topic

tangkaro

Still a few 0.1uF caps missing.
i will place bypass cap 0.1 uF on all supply volt of the chips. seems not drawn in my diagrm

tangkaro

#31
Sep 23, 2015, 03:08 pm Last Edit: Sep 23, 2015, 03:26 pm by tangkaro Reason: have errors
--I don't understand why you do not want to chain all the tpic chips.

Not sure why you have those fixed resistors on the analog inputs. Its usual to connect the pots between 5V and GND and connect their wipers to the analog inputs.
'coz i think i will br confused for its codes for the timer and point counting

its bcoz i saw diagram of force sensor conncted to arduino with that fixed resistor/pull down. should i rather remove it?

PaulRB

#32
Sep 24, 2015, 12:32 am Last Edit: Sep 24, 2015, 12:33 am by PaulRB
Many sensors, like force sensors, ldr and thermistors, have only two terminals. Their resistance changes as the force/light/temperature changes. The Arduino cannot measure this resistance directly. In order to measure the resistance, you must use a second fixed resistor to form a voltage divider. The voltage between the sensor and the fixed resistor is measured by the Arduino analog pin.

Potentiometers have 3 terminals. They can be used as a voltage divider without need for a second resistor. So yes, you can remove the fixed resistors from your circuit.

tangkaro


teamasno

hey. is it possible for arduino to display countdown timer (using 7 segment display ) while it accepts value from the sensor and validate if it will display 1 point (using 7 segment). is this parallel processing? thanks.

PaulRB

hey. is it possible for arduino to display countdown timer (using 7 segment display ) while it accepts value from the sensor and validate if it will display 1 point (using 7 segment). is this parallel processing? thanks.
Hi,

You should start a new topic for your questions. But my answers are: yes; don't understand; no.

Paul

teamasno


tangkaro

hi! I tried some codes for my 7 segment display, I used tpic6c595 shift register. but I can't do it right. it can't display 0-9. just random like binary. it's just a single digit yet I can't manage to do it right. lol. I will post the code that I tried. credit to its author. what is wrong? maybe its me? haha

PaulRB

#38
Jan 09, 2016, 03:13 pm Last Edit: Jan 09, 2016, 03:15 pm by PaulRB
Always post your code in tags like this so everyone can read it.

Code: [Select]
int latchPin = 5;
int dataPin = 4;
int clockPin = 6;

void setup() {
  // put your setup code here, to run once:
pinMode (latchPin, OUTPUT);
pinMode (dataPin, OUTPUT);
pinMode (clockPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
//0
digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 64);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST,121);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 36);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 48);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST,25);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 18);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 2);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST,120);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 0);
digitalWrite (latchPin, HIGH);
delay (1000);

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, 24);
digitalWrite (latchPin, HIGH);
delay (1000);
}

PaulRB

#39
Jan 09, 2016, 03:29 pm Last Edit: Jan 09, 2016, 03:44 pm by PaulRB
Those numbers you are shifting out: 64, 121 etc. Did you choose those? If not, they are probably not correct for your circuit.

What you need to do is figure out which '595 outputs 0 to 7 are connected to which segment A to G and dp. Then you can work out the binary codes to shift out.

For example, suppose your connections are:
0-A
1-B
2-C
3-D
4-E
5-F
6-G
7-X

 AAA
F   B
F   B
F   B
 GGG
E   C
E   C
E   C
 DDD  X



To make the digit "2", you want to light every segment except C and F.

So the code would be 0bXGFEDCBA which is 0b01011011

tangkaro

i did it now the 0-9 display. i have the screenshot of the tutorial i tried. I'm using common anode display yet the common cathode data works on mine. maybe because of the data, confusing but least i saw it works.

PaulRB


PaulRB

#42
Jan 09, 2016, 05:44 pm Last Edit: Jan 09, 2016, 06:09 pm by PaulRB
i did it now the 0-9 display. i have the screenshot of the tutorial i tried. I'm using common anode display yet the common cathode data works on mine. maybe because of the data, confusing but least i saw it works.
I don't understand what you are saying. Do you still have a problem or is it working OK now? If not, please give more details.

I would expect the "common cathode" numbers from your table to work correctly. The common cathode vs common anode numbers were meant to apply to driving small displays with a 74hc595, I suspect. In that case, for a common-anode display, you would send a zero to an output so that it will sink current and light the segment. However, you are using a tpic6c595. With that chip, if you send a 1 to an output then it will sink current.

Here is a shorter and better way to write your sketch:

Code: [Select]
int latchPin = 5;
int dataPin = 4;
int clockPin = 6;

const byte pattern[10] = {
  //XABCDEFG
  0b01111110, //0
  0b00110000, //1
  0b01101101, //2
  0b00110011, //3
  0b01011011, //4
  0b01011111, //5
  0b01011111, //6
  0b01110000, //7
  0b01111111, //8
  0b01110011  //9
};

void setup() {
  // put your setup code here, to run once:
  pinMode (latchPin, OUTPUT);
  pinMode (dataPin, OUTPUT);
  pinMode (clockPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

  for (int i = 0; i <= 9; i++) {
    digitalWrite (latchPin, LOW);
    shiftOut (dataPin, clockPin, MSBFIRST, pattern[i]);
    digitalWrite (latchPin, HIGH);
    delay (1000);
  }
}


tangkaro

thanks! now what my problem would be is that how will i improve this code that whenever one of the three switches got high the display will count up by 1 . and also it will become 3 digits now. I'm trying. lol

tangkaro

aha. so that's why the common cathode table works correctly ..

Go Up