- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having trouble casting and array to pass to a function. In the code below I am wanting to pass an array of ASCII HEX characters to a function that generates the Decimal value for each pair of characters.
The line putting the rssult int the RawData array is coming up with error "Passing argument 1 of ASCIIHEX_to_DEC make pointer to interger without a cast.
I have tried several approaches to modify the type being passed but cannot get figure out what I need to do to fix it.
Thanks
uint8 ASCIIHEX_to_DEC(char * ascii)
{
uint8 decval;
if(ascii[0] >= 'A') decval = ((uint8) ascii[0] - 55) << 4; else decval = (uint8) ascii[0] << 4;
if(ascii[1] >= 'A') decval += (uint8) ascii[1] - 55; else decval += (uint8) ascii[1];
return decval;
}
//[MESSAGE_TYPE] [MESSAGE_TYPE] [DATA_LENGTH] [DATA_LENGTH] [DATA] [DATA] ... [DATA] [CRC] [CRC] [CRC] [CRC] [FOOTER_FLAG (0x7D)]
void ProcessFrame(char * buf, uint8 packetsize)
{
uint8 RawData[30];
uint8 command;
uint8 i;
for(i= 0 ; i < (packetsize/2); i++)
{
RawData = ASCIIHEX_to_DEC(buf[i*2]);
}