Digits[] is supposed to be constant and contain pointers to constant pointers, right?
Perhaps the precedence of * here could be a problem and maybe
const BYTE * Digits[] = {DIGIT1,DIGIT2,DIGI3,DIGIT4,DIGIT5,DIGIT6};
should be
const BYTE (*Digits)[] const = {DIGIT1,DIGIT2,DIGI3,DIGIT4,DIGIT5,DIGIT6};
http://en.wikipedia.org/wiki/Const-correctness
I also suggest adding that second "const". I don't think that is the problem, but if there is a bug that attempts to change Digits then that might help you find it. (BTW, it might be helpful to attempt to differentiate your variable names more -- the word "digit" is used in many forms and it would be easy for someone [especially an outsider like myself] to mistake one for another.)
BTW, I think you made a typo here (shouldn't it be ++ not **?)
digit**;//incrememt pointer
The way that I usually go about writing a 7-segment display interface is something like this:
// Human-readable bit values
#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define BIT5 0x20
#define BIT6 0x40
#define BIT7 0x80
// Number of available positions on display
#define NUM_DIGITS 4
// Map symbols to segments
#define SYMBOL_0 (BIT0 | BIT1 | BIT2)
#define SYMBOL_1 (BIT0 | BIT5)
// (these are just examples -- not real mappings)
// function prototypes
void display_number(int number); // calls display_digit once per digit
void display_digit(unsigned char symbol, unsigned char position); // writes symbol to one of the 7-segment positions
void display_refresh(); // Scans through each digit and illuminates segments again
const unsigned char digit_map[] = { SYMBOL_0, SYMBOL_1, ...}
unsigned char digits_being_displayed[NUM_DIGITS];
// (in main)
int x = 1234;
display_number(x);
// ...
// (in polling/timer loop)
display_refresh();
// (in display_number)
// Note: need to handle signs, convert number, etc. this is just for illustration
// ...
for (int pos=0; pos < NUM_DIGITS; pos++) {
int i, temp = number;
// get corresponding digit (depending on how you number your digits, this could be different)
for (i=1; i<(pos+1); i++)
temp /= 10;
temp %= 10;
switch (temp) {
case 0:
digit = SYMBOL_0;
break;
case 1:
digit = SYMBOL_1;
break;
// ...
}
display_digit(digit_map[digit], pos);
}
// ...
// (in display_digit)
digits_being_displayed[position] = value; // this value can get written periodically to the display with display_refresh()
So I'm not quite familiar with the syntax / structures you are using (e.g. BYTE = {}) but I hope my comments are still helpful. If you like enum better than #define that is fine too, of course.
Best Answer
I thought SI could be distinguished by the lowercase 'k'? In any case, because of the structure of address lines, memory is almost always a power of two in size. So it's 65536 bytes.
(Hard disk manufacturers have taken to using SI as it produces larger numbers for the same number of storage units, but this hasn't spread to RAM/EEPROM yet)