我在AVR V4中有一个程序,其代码如下:
#include <avr/pgmspace.h>
void nlcd_Putc(unsigned char c)
{
unsigned char i;
if (c>127) c=c-64;
for (i = 0; i < 5; i++ )
{
nlcd_SendByte(DATA_LCD_MODE,pgm_read_byte(&(nlcd_Font[c-32][i])));
}
nlcd_SendByte(DATA_LCD_MODE,0x00);
}因此,当我想在MiKroC中为AVR运行这段代码时,我得到以下错误:
表达式1228324未声明的标识符“pgm_read_byte”
我应该将报头avr/pgmspace.h添加到AVR的MiKroc中,还是在Mikroc中为AVR添加与avr/pgmspace.h等效的标题?
非常感谢。
发布于 2015-12-24 10:03:22
通过将此代码添加到标题中:
typedef signed char int8;
typedef unsigned char uint8;
typedef signed int int16;
typedef unsigned int uint16;
typedef signed long int int32;
typedef unsigned long int uint32;
//-----------------------
#define PGM_P char flash *
#define PROGMEM flash
#define const flash
#define PSTR(x) x
#define EEMEM eeprom
#define pgm_read_byte(x) (*((uint8 flash *)(x)))
#define pgm_read_word(x) (*((uint16 flash *)(x)))
#define pgm_read_float(x) (*((uint32 flash *)(x)))
#define pgm_read_byte_near(x) (*((uint8 flash *)(x)))https://stackoverflow.com/questions/34383696
复制相似问题