5 Replies Latest reply on Dec 2, 2014 2:38 AM by user_1377889

    Problem passing array to function


       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.






      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;








      void ProcessFrame(char * buf, uint8 packetsize)  




          uint8 RawData[30];


          uint8 command;


          uint8 i;




          for(i= 0 ; i < (packetsize/2); i++)




            RawData[i] = ASCIIHEX_to_DEC(buf[i*2]);