bugAVR C Runtime Library - Bugs: bug #12134, ADC register name definitions


bug #12134: ADC register name definitions

Submitted by:  None
Submitted on:  Fri 25 Feb 2005 04:45:00 AM UTC  
Category:  Library Severity:  3 - Normal
Priority:  7 - High Item Group:  None
Status:  Fixed Assigned to:  None
Percent Complete:  0% Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  None
Fixed Release:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 04 Jun 2005 09:55:52 PM UTC, comment #3: 

This path define ADC registers like so:

 #ifndef _ASSEMBLER_
 #define ADC      _SFR_IO16 (0x04)
 #define ADCW    _SFR_IO16(0x04)
 #define ADCL      _SFR_IO8(0x04)
 #define ADCH     _SFR_IO8(0x05)

Anatoly Sokolov <aesok>
Project Administrator
Thu 17 Mar 2005 07:31:37 AM UTC, comment #2: 

Comments forwarded from the debian Bug #299881:

The Analog to Digital Converter registers are defined like so:

#define ADC      _SFR_IO16(0x04)
#define ADCL     _SFR_IO8(0x04)
#define ADCH     _SFR_IO8(0x05)

This is somewhat unfortunate, because "ADC" is also the ADd with Carry
instruction in assembly.  This breaks preprocessed assembly files
which use capital instruction mnemonics.  (ADCL and ADCH do not
conflict with anything).

Perhaps the 16-bit ADC register could be renamed, or simply not
defined when _ASSEMBLY_ is defined.  Whatever solution is
implemented should probably be tested with a C program with inline
assembly as well.

I filed this as "minor" because it's easy to work around by undefining
ADC again after including the header.

Tue 15 Mar 2005 09:37:45 PM UTC, comment #1: 

I remember an old discussion that the use of ADC was
deprecated as it might conflict with the assembler
instruction named ADC (add with carry).  As <avr/io.h> is
supposed to be includable into assembler sources, any
#define for ADC would shadow that instruction.

One solutions would be to deprecate the ADC alias, but enable
it for !assembler compilations until it will eventually be
phased out.

Joerg Wunsch <joerg_wunsch>
Project Administrator
Fri 25 Feb 2005 04:45:00 AM UTC, original submission:  

In the previous release of WINAVR the ADC conversion result was to be found in ADCW register ( in case of mega16 and mega8).

Current release lists ADC for mega16 and ADCW for mega8. in their respective iom16.h and iom8.h files under winavr\avr\include\avr subdiretory.

other iomxxx.h files may also contain ADC as the definition of register.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #3034:  adc-regs-patch.diff added by aesok (10KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty




Follow 8 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-06-28 aesok StatusNone => Fixed
    Assigned toaesok => None
    Open/ClosedOpen => Closed
2005-06-27 aesok Assigned toNone => aesok
2005-06-04 aesok Attached File- => Added adc-regs-patch.diff, #2570
2005-02-25 arcanum Priority5 - Normal => 7 - High
    SummaryADC registre name definitions => ADC register name definitions
2005-02-25 None Carbon-Copy- => Added qtest --AT-- powerup --DOT-- com --DOT-- au

Back to the top

Powered by Savane 3.5