What you do here is very dangerous. You read some bytes from a rs485 and based on these bytes try to overwrite memory in your device without any checks. Any glitch in your serial line will corrupt your device in a most horrible way. Also the logic is strange, the check
if (RS485_RX_BUFFER[4]==0) does not do anything The whole code can be written as : unsigned char xdata RS485_RX_BUFFER[48]; unsigned char xdata RS485_TX_BUFFER[48]; void RS485_Msg_Parser(void) { unsigned char *BaseAdd; BaseAdd = (unsigned char xdata *) ((RS485_TX_BUFFER[3]<<8)+RS485_TX_BUFFER[4]); *BaseAdd=RS485_RX_BUFFER[6+i]; // danger danger danger TODO fix this (where does i come from?) } On Thu, Oct 13, 2011 at 9:10 AM, Sujata Biradar <sujata.bira...@navsemi.com> wrote: > Hi, > error in c code : > > > unsigned char xdata RS485_RX_BUFFER[48]; > unsigned char xdata RS485_TX_BUFFER[48]; > > void RS485_Msg_Parser(void) > { > unsigned char *BaseAdd; > if(RS485_RX_BUFFER[4]==0) > BaseAdd = (unsigned char > *)((RS485_TX_BUFFER[3]<<8)+RS485_TX_BUFFER[4]); > else > BaseAdd = (unsigned char xdata > *)((RS485_TX_BUFFER[3]<<8)+RS485_TX_BUFFER[4]); > > *BaseAdd=RS485_RX_BUFFER[6+i]; > } > > > > I got following error after if statement , > the error is non-pointer type cast to generic pointer.Is this limitation in > SDCC ?.Can any one give solution for this.? > > > Regards > Sujata > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user