Hello,
I am having 8052 based project. I am using Keil Microvision 3 compiler and am using PC-Lint for error checking and debugging. I am using absolute memory access macros of Keil for memory mapping in my project, which is as follows:
Project filename is Led.c
#include<Reg52.h> /* Keil header file for 8052 variants */ #include <absacc.h> /* Include Absolute Memory Access Macro Definitions. this is provided by Keil. The absolute memory access macros allow you to directly access the various memory areas of the 8051. These macros require that you specify the address you wish to read or write */ #define XBYTE ((unsigned char volatile xdata *) 0) /* This is provided from the Keil absacc.h file */ #define LED_LATCH XBYTE[0x8600] /* using Absolute Memory Access Macro of Keil*/ #define LEDS_ON 0X00 #define LEDS_OFF 0XFF unsigned char code led_seq[8] = {0XFE,0XFD,0XFB,0XF7,0xEF,0xDF,0xBF,0x7F}; /* This part of code glows the 8 LEDs one by one(connected thro memory-mapped hardware).*/ void delay(unsigned int i) { for(;i>0;i--) ; } void runLeds(void) { unsigned char i; LED_LATCH = LEDS_OFF; //Line 35 for(i=0;i<8;i++) { LED_LATCH = led_seq[i]; delay(2000); } LED_LATCH = LEDS_OFF; } void main(void) /* code starts here */ { -- -- while(1)/* SuperLoop that runs forever */ { -- -- runLeds(); -- -- } }
Keil compilation is ok. But, PC-Lint is generating the warning: " Warning 413: Likely use of null pointer 'unknown-name' in left argument to operator '[' [Reference: file .\Led.c: line 35]
Q: What is the problem with this usage? Is there any other way to use memory-mapping? How to fix this Warning or atleast supress this message?