[Top][All Lists]

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

[avr-gcc-list] mission: impossible

From: Victor Sluiter
Subject: [avr-gcc-list] mission: impossible
Date: Fri, 22 Feb 2002 15:36:02 +0100 (MET)

Hello all,

I am busy developing an application on 90S8535. Depending on a serial number
that is located in program memory, a define should get another value.. Err..
Let me explain that... I use things like 

#define SET(X) sbi(X)
#define CLR(X) cbi(X)
#define LED1 PORTC,PC0

so I can use CLR(LED1) and SET(LED1) to turn a LED on or off. If I port the
application to another controller with the same leds on other ports (and
that's the hardware I've got - can't do nothing about that), I only have to
change the #define LED1 to change that in the complete program. Now for the
problem. In the program memory a serial number is placed in a fixed location
(0x005E). Depending on the serial number another layout is made on the machine,
changing the pins where the Leds are placed (sigh.... again, I cannot change
that....).  Now I would like to make something like: 

#if serial number == 1
 #define LED1 PORTC,PC1
#elif serial number == 2
 #define LED1 PORTC,PC2

I know it is not possible to directly do #if PRG_RDB(0x005E) == 1 , and I've
tried many workarounds. I think it is a bit of a mission impossible, but
before I abandon my 'SET' and 'CLR' routines, I hope someone on this list has a
good idea :-). Any help would be welcome....

Another question, and I'm sorry if it is too much off-topic: a friend of
mine would like to start making programms in AVR-GCC, but he knows little about
C and a lot about assembly and processor architecture. Anyone knows a good
book on how to start learning C for AVR or other uC?

Thanks in advance, Victor Sluiter

GMX - Die Kommunikationsplattform im Internet.

avr-gcc-list at http://avr1.org

reply via email to

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