[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] avr-gcc - global variables
From: |
Stein Haaland |
Subject: |
[avr-gcc-list] avr-gcc - global variables |
Date: |
Tue, 28 Sep 2004 23:28:27 +0200 |
User-agent: |
KMail/1.6.1 |
I am trying to write a number of bytes into EEPROM
(actually a set of characters for a 5x7 dot matrix),
and need some help with global variables :
a) What is wrong with the following code :
//
// character = global variable
//
volatile uint8_t character[90][7] =
{
{ 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F },
{ 0x13, 0x13, 0x13, 0x13, 0x13, 0x1F, 0x13 },
{ 0x15, 0x15, 0x15, 0x1F, 0x1F, 0x1F, 0x1F },
{ ... }
};
void fill_eeprom()
{
uint8_t val;
uint16_t i,j,addr;
for (i=0; i<90; i++) {
for (j=0; j<7; j++) {
addr = 7*i+j;
val = character[i][j];
eeprom_wb(addr,val);
PORTC = ~val;
wait(400);
PORTC = ~0x00;
wait(400);
}
}
}
void main(void)
{
....
}
Port C switches between 0xFF (= ~0x00) and 0x00 - no sign
of my character table.
b) Is there a better way to do this than the above approach ?
Sys :
MDK Linux 10.0.
avr-gcc (GCC) 3.3.2
objcopy 2.14 20030612
uisp version 20040311
STK500 testboard, AT90S8515
------
SEH.
- [avr-gcc-list] avr-gcc - global variables,
Stein Haaland <=