1. ## Seven Segment Display???

I'm a college student working out of programming pearls as a means of studying. I'm kind of stumped at the following question.

Column 3 problems:

Write a program that displays a 16-bit positivwe integer in five seven-segment digits. The output is an array of 5 bytes; bit i of byte j is on if and only if the ith segment of digit j should be on.

Even after doing some reading I'm a bit confused, anyone worked with the book before and know a good place to start? Or can shed some light on the problem? Thanks in advance

2. So each segment on a 7 segment display is represented by one bit in a byte. I have no idea what order those seven segments are - you can find some info here:
http://en.wikipedia.org/wiki/Seven-segment_display

--
Mats

3. ya that's where I did some of my reading. I'm completely confused. I think i'm just gonna dive in and code and see what type of results I get.

4. Diving in and coding is probably not the BEST idea - but perhaps you can try to do just a simple write-up on what you think you need. If you are uncertain about whether you got it right, post here, and I'm sure someone will help out.

When you write up what you need to do, you should split it up in really simple forms, and if anything seems complicated, split it into smaller steps.

--
Mats

5. Would the following shed any light?
Code:
```/*
* Change the following definitions to suit the hardware.
*/
#define SEG_A 0x01
#define SEG_B 0x02
#define SEG_C 0x04
#define SEG_D 0x08
#define SEG_E 0x10
#define SEG_F 0x20
#define SEG_G 0x40
/*
* See http://en.wikipedia.org/wiki/Image:7_segment_display_labeled.svg
*/
#define DISP_ZERO  (SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F        )
#define DISP_ONE   (        SEG_B | SEG_C                                )
#define DISP_TWO   (SEG_A | SEG_B |         SEG_D | SEG_E |         SEG_G)
#define DISP_THREE (SEG_A | SEG_B | SEG_C | SEG_D |                 SEG_G)
#define DISP_FOUR  (        SEG_B | SEG_C |                 SEG_F | SEG_G)
#define DISP_FIVE  (SEG_A |         SEG_C | SEG_D |         SEG_F | SEG_G)
#define DISP_SIX   (SEG_A |         SEG_C | SEG_D | SEG_E | SEG_F | SEG_G)
#define DISP_SEVEN (SEG_A | SEG_B | SEG_C                                )
#define DISP_EIGHT (SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G)
#define DISP_NINE  (SEG_A | SEG_B | SEG_C | SEG_D |         SEG_F | SEG_G)```
Perhaps even this too?
Code:
```const unsigned char Digit[10] =
{
DISP_ZERO, DISP_ONE, DISP_TWO,   DISP_THREE, DISP_FOUR,
DISP_FIVE, DISP_SIX, DISP_SEVEN, DISP_EIGHT, DISP_NINE,
};```

6. Here is one way.. Coding it is up to you:

Code:
```char array[9][10][20] =
{
{" ### ","    "," ### "," ### ","     "," ### "," ### "," ### "," ### "," ### "},
{"#   #","   #","    #","    #","#   #","#    ","#    ","    #","#   #","#   #"},
{"#   #","   #","    #","    #","#   #","#    ","#    ","    #","#   #","#   #"},
{"#   #","   #","    #","    #","#   #","#    ","#    ","    #","#   #","#   #"},
{"     ","    "," ### "," ### "," ### "," ### "," ### ","     "," ### "," ### "},
{"#   #","   #","#    ","    #","    #","    #","#   #","    #","#   #","    #"},
{"#   #","   #","#    ","    #","    #","    #","#   #","    #","#   #","    #"},
{"#   #","   #","#    ","    #","    #","    #","#   #","    #","#   #","    #"},
{" ### ","    "," ### "," ### ","     "," ### "," ### ","     "," ### "," ### "},
};```
The algorithm is insanely simple, and the array can be modified to suit your assignment.