[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] avr-gcc - global variables

From: Bernard Fouche
Subject: RE: [avr-gcc-list] avr-gcc - global variables
Date: Wed, 29 Sep 2004 00:18:50 +0200

Is DDRC == 0xFF ? I suppose that you have plugged PORTC to the bank of leds
on the STK, however you must specify that the port is to be used as an out

The libc also gives you eeprom_write_byte(), try to use it to check if it
works better than eeprom_wb() that I don't know, if you have storage

If you want to store data in the EEPROM once, you could also build a Intel
Hex File and ask avrdude/uisp to send it to your chip. It's handy to have
around some code to do that, it spares code room inside the target and you
don't need to compile if you want to change your character font.

Hope it helps.


-----Message d'origine-----
De : address@hidden
[mailto:address@hidden la part de Stein Haaland
Envoye : mardi 28 septembre 2004 23:28
A : address@hidden
Objet : [avr-gcc-list] avr-gcc - global variables

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];
       PORTC = ~val;
       PORTC = ~0x00;

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


avr-gcc-list mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]