глюк в авр-гцц-3.3.2 или у меня?

Очень рад вас видеть, All!

=== Cut === avr-gcc-3.3.2

/* Description : Output 1 Byte Hexadecimal digit to 2Byte ASCII character. Argument : byData - character to output

*/ void PutHTOA(UCHAR byData) { char *HexDigit =PSTR("0123456789ABCDEF"); PutByte(pgm_read_byte(HexDigit+((byData>>4)&0x0f))); PutByte(pgm_read_byte(HexDigit+(byData&0x0f))); }

/* Description : Output 2 Byte Integer to 4Byte ASCII character Argument : byData - Integer to output

*/ void PutITOA(UINT byData) { PutHTOA((byData>>8) & 0xFF); PutHTOA(byData & 0xFF); }

// i типа унс.чар и SSIZE[] типа unsigned int

//кусок с глюком //----------------------------- break; case 1: SSIZE[i] = 2048; SMASK[i] = 0x000007FF; PutITOA(SSIZE[i]); PutITOA(SSIZE[i]); break; case 2: //----------------------------- //выводит:08000202 === Cut ===

первый вывод - 0800 верный, второй 0202 - фигня... кусок листинга здоровый, цеплять не буду (пока)

кусок МАКЕ (флаги компилятора)

=== Cut ===

OPT = s

CSTANDARD = -std=gnu99

# Place -D or -U options here CDEFS =

# Place -I options here CINCS =

# Compiler flags. # -g: generate debugging information # -O*: optimization level # -f...: tuning, see GCC manual and avr-libc documentation # -Wall...: warning level # -Wa,...: tell GCC to pass this to the assembler. # -adhlns...: create assembler listing CFLAGS = -g CFLAGS += $(CDEFS) $(CINCS) CFLAGS += -O$(OPT) CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CFLAGS += -Wall -Wstrict-prototypes CFLAGS += -Wa,-adhlns=$(<:.c=.lst) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) CFLAGS += $(CSTANDARD)

=== Cut ===

AVL

Reply to
Vasiliy Andreev
Loading thread data ...

Привет Vasiliy!

21 Jun 04 12:20, Vasiliy Andreev писал All:

VA> /* VA> Description : Output 1 Byte Hexadecimal digit to 2Byte ASCII VA> character. Argument : byData - character to output */ void VA> PutHTOA(UCHAR byData) { VA> char *HexDigit =PSTR("0123456789ABCDEF"); VA> PutByte(pgm_read_byte(HexDigit+((byData>>4)&0x0f))); VA> PutByte(pgm_read_byte(HexDigit+(byData&0x0f))); VA> }

Твой пример вырван из контекста. Как у тебя определен UCHAR? Кто такие PutByte и pgm_read_byte? Кто такой PSTR?...

Приведи полностью пригодный к компиляции фрагмент, тогда можно будет что-то проверить. Hеплохо было бы взять в руки gdb, найти место, из-за которого 0800 превращяется в 0202, и приложить этот кусок тоже...

Всего наилучшего, [Team PCAD 2000] Алексей М. ... Старый глюк лучше новых двух...

Reply to
Alex Mogilnikov

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.