Tabela na flash

Software e Hardware para linha ARM

Moderadores: 51, guest2003, Renie, gpenga

Tabela na flash

Mensagempor lafourcade » 04 Abr 2007 16:11

Ola

Eu estou com dificuldades de criar uma tabela na Flash do LPC2103 com end definido. Eu utilizo o Keil uvision3.
Eu tentei oque eu ja conhecia:
const char Text_Table [16] @0x000010FF ={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
mas não da certo, ele não aceita o @.

Outra dúvida, seria: como eu discrimino uma variável de um bit? No Code Warrior (freeescale 8 bits) eu fazia assim:

volatile union _tyBits1 {
unsigned char vByte1;
struct
{
unsigned char Bit3_0:1;
unsigned char Bit3_1:1;
unsigned char Bit3_2:1;
unsigned char Bit3_3:1;
unsigned char Bit3_4:1;
unsigned char Bit3_5:1;
unsigned char Bit3_6:1;
unsigned char Bit3_7:1;
} vBits1;
};

union _tyBits1 _flags3;
#define flags3 _flags3.vByte1
#define blablabla _flags3.vBits1.Bit3_0
#define blablabla _flags3.vBits1.Bit3_1
#define blablabla _flags3.vBits1.Bit3_2
#define blablabla _flags3.vBits1.Bit3_3
#define blablabla _flags3.vBits1.Bit3_4
#define blablabla _flags3.vBits1.Bit3_5
#define blablabla _flags3.vBits1.Bit3_6
#define blablabla _flags3.vBits1.Bit3_7

mas no uvision tb não da certo.

Apelo para os mais experientes...

Obrigado
lafourcade
Byte
 
Mensagens: 123
Registrado em: 20 Out 2006 06:40

Mensagempor barboza » 04 Abr 2007 16:54

Variables in your C program may be located at absolute memory locations by using the __at keyword.

type variable-name __at address « = value »;
Where

type is the C data type of the variable.
variable-name is the name of the variable.
address is the address where the variable is stored.
value is the value assigned to the variable.

The __at keyword only applies to variables. It may not be used with function definitions.

The following example demonstrates how to locate several different variable types using the __at keyword.

struct link
{
struct link idata *next;
char code *test;
};

struct link list [100] __at 0x00014000; /* list at 0x00014000 */

Use the following external declaration if you declare variables using the __at keyword in one source module and access them in another.

struct link
{
struct link idata *next;
char code *test;
};

extern struct link list [100]; /* list at 0x00014000 */
Os homens mentiriam muito menos se as mulheres fizessem menos perguntas.
Avatar do usuário
barboza
Word
 
Mensagens: 948
Registrado em: 17 Out 2006 13:42
Localização: Longe de onde gostaria de estar

Mensagempor lafourcade » 04 Abr 2007 17:23

Cara, Obrigado!

Testei e funcionou. Sabe me dizer como eu defino um bit, que eu possa usar como flag?
lafourcade
Byte
 
Mensagens: 123
Registrado em: 20 Out 2006 06:40

Mensagempor barboza » 05 Abr 2007 09:46

/************************************************************************/
/* Estrutura do rtc HT1380 */
/************************************************************************/

struct st_ht1380
{
/* Endereço 0 */
byte u_sec : 4; /* Unidade de segundos */
byte d_sec : 3; /* Dezena de segundos */
byte ch : 1; /* Clock Halt Bit */

/* Endereço 1 */
byte u_min : 4; /* Unidade de minutos */
byte d_min : 3; /* Dezena de minutos */
byte vago1 : 1; /* Bit Vago */

/* Endereço 2 */
byte u_hora : 4; /* Unidade das horas */
byte d_hora : 2; /* Dezena das horas */
byte vago2 : 1; /* Bit Vago */
byte modo : 1; /* Modo 12 ou 24 Horas */

/* Endereço 3 */
byte u_dia : 4; /* Unidade do dia */
byte d_dia : 2; /* Dezena do dia */
byte vago3 : 2; /* Bit´s Vagos */

/* Endereço 4 */
byte u_mes : 4; /* Unidade do mes */
byte d_mes : 1; /* Dezena do mes */
byte vago4 : 3; /* Bit´s Vagos */

/* Endereço 5 */
byte dia_s : 4; /* Unidade do dia semana */
byte vago5 : 4; /* Bit´s Vagos */

/* Endereço 6 */
byte u_ano : 4; /* Unidade do ano */
byte d_ano : 4; /* Dezena do ano */

/* Endereço 7 */
byte vago7 : 7; /* Bit´s Vagos */
byte wp : 1; /* Write Protect Bit */
};

union un_ht1380
{
byte addr[RTC_QTD_REG];
struct st_ht1380 st_1380;
};

union un_ht1380 idata rtc_1380;

rtc_1380.st_1380.ch = FALSE; // Habilite o oscilador.

rtc_1380.st_1380.modo = FALSE; // Trabalhe em modo de 24 horas.


Usei isso com o 8051!
Os homens mentiriam muito menos se as mulheres fizessem menos perguntas.
Avatar do usuário
barboza
Word
 
Mensagens: 948
Registrado em: 17 Out 2006 13:42
Localização: Longe de onde gostaria de estar


Voltar para ARM

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante

x