求助:avr编程 WinAVR程序移植到iar for avr 出现错误
WinAVR pgmspace.h 头文件 函数[url=]表情[/url]
#definepgm_read_byte(address_short) pgm_read_byte_near(address_short)
iar for avr pgmspace.h 头文件 函数 没有pgm_read_byte函数
- /* PGM_P points into program address space */ PGM_P指向程序地址空间
- #ifdef __HAS_ELPM__
- #define PGM_P const char __farflash *
- #define PGM_VOID_P const void __farflash *
- #else
- #define PGM_P const char __flash *
- #define PGM_VOID_P const void __flash *
- #endif /* __HAS_ELPM__ */
- #define __PRINTFPR_P _Pragma("__printf_args") \
- _Pragma("library_default_requirements _formatted_write_P = unknown")
- #define __SCANFPR_P _Pragma("__scanf_args") \
- _Pragma("library_default_requirements _formatted_read_P = unknown")
- /* Language extensions are necessary to cope with multiple address spaces */
- 必须使用语言扩展才能应对多个地址空间
- #pragma language=save
- #pragma language=extended
- __PRINTFPR_P int printf_P(PGM_P __format,...);
- __SCANFPR_P int scanf_P(PGM_P __format,...);
- __PRINTFPR_P int sprintf_P(char *__s,PGM_P __format,...);
- __SCANFPR_P int sscanf_P(const char *__s, PGM_P __format,...);
- int puts_P(PGM_P __s);
- PGM_P strerror_P(int errnum);
- size_t strlen_P(PGM_P s);
- __x_z int memcmp_P(const void *, PGM_VOID_P, size_t);
- __x_z void *memcpy_P(void *, PGM_VOID_P, size_t);
- __x_z char *strcat_P(char *, PGM_P);
- __x_z int strcmp_P(const char *, PGM_P);
- __x_z char *strcpy_P(char *, PGM_P);
- __x_z char *strncat_P(char *, PGM_P, size_t);
- __x_z int strncmp_P(const char *, PGM_P, size_t);
- __x_z char *strncpy_P(char *, PGM_P, size_t);
- __x_z int memcmp_G(const void *, const void __generic *, size_t);
- __x_z void *memcpy_G(void *, const void __generic *, size_t);
- __x_z char *strcat_G(char *, const char __generic *);
- __x_z int strcmp_G(const char *, const char __generic *);
- __x_z char *strcpy_G(char *, const char __generic *);
- __z size_t strlen_G(const char __generic *);
- __x_z char *strncat_G(char *, const char __generic *, size_t);
- __x_z int strncmp_G(const char *, const char __generic *, size_t);
- __x_z char *strncpy_G(char *, const char __generic *, size_t);
- int puts_G(const char __generic *);
复制代码
现在WinAVR程序 移植到iar for avr pgm_read_byte 出现错误 请求指导 下面程序程序 应该怎么改?
- void Common_Show(INT8U P,INT8U L,INT8U W,char *r)
- {
- INT8U i;
- //显示在左半屏或左右半屏
- if(L < 64)
- {
- CS1_1(); CS2_0();
- LCD_Write_Command(LCD_PAGE+P);
- LCD_Write_Command(LCD_COL+L);
- //全部显示在左半屏
- if(L + W < 64)
- {
- for(i=0; i<W; i++) LCD_Write_Data(<b>pgm_read_byte</b>(r+i));
- }
- //如果越界则跨越左右半屏显示
- else
- {
- //左半屏显示
- for(i=0; i<64-L; i++) LCD_Write_Data(<b>pgm_read_byte</b>(r+i));
- //右半屏显示
- CS1_0(); CS2_1();
- LCD_Write_Command(LCD_PAGE+P);
- LCD_Write_Command(LCD_COL);
- for(i=64-L; i<W; i++) LCD_Write_Data(<b>pgm_read_byte</b>(r+i));
- }
- }
- //全部显示在右半屏
- else
- {
- CS1_0(); CS2_1();
- LCD_Write_Command(LCD_PAGE+P);
- LCD_Write_Command(LCD_COL+L-64);
- for(i=0; i<W; i++) LCD_Write_Data(<b>pgm_read_byte</b>(r+i));
- }
- }
复制代码
|