Go Down

Topic: 7 segment decoder (Read 639 times) previous topic - next topic

bkmtech

Greetings

My name is Brian, and I would like help creating code for the Arduino ONO.

Its sole purpose will be to take a byte of data, and we can define this byte from scratch, and using Bits 1 through 7 drive the 7 segments of a 7 seven segment led display.   Bit 0 of this byte of data will be ignored, and PD0 will be used as RXD.  I will not need code for that function, but the port will have to defined properly, if I'm not mistaken.

Essentially, using the highest 7 bits of a byte of data I will drive a 7 segment display.

The bits are currently assigned as follows

Segment A = PD1   

Segment B = PD2

Segment C = PD3   

Segment D = PD4   

Segment E = PD5

Segment F = PD6   

Segment G = PD7


Everything can be defined from scratch, and the pin mapping can change, but prefer not to.

Thanks in advance.


AWOL

Common cathode or common anode?

CrossRoads

Code: [Select]

byte fontArray[] = {
// common cathode. invert data for common anode.
//Current limit resistor per segment!
0b01111110, // 0, high = segment on
0b00000110, // 1  g-f-e-d-c-b-a-x
0b10110110, // 2          a
0b10011110, // 3      f        b
0b11001100, // 4          g
0b11011010, // 5       e        c
0b11111010, // 6            d
0b00001110, // 7
0b11111110, // 8
0b11011110, // 9
};

// to display
PORTD = fontArray[digitToDisplay];
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

If you use Serial.begin(speed), how will you overcome TX output on D1?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up