FrustratedEngineer
Newbie level 6
Guys,
I have developed an application for PIC18F45K40.
The char array is passed to the function as Pointer. When I see in the definition of the function, the pointer doesn't carry the values of the Array element. I have tried passing directly string as an argument but even that doesn't work. My first guess is that it is Near/Far pointer problem. I tried using that but code never compiled. Please let me know how to resolve this problem.
I have developed an application for PIC18F45K40.
The char array is passed to the function as Pointer. When I see in the definition of the function, the pointer doesn't carry the values of the Array element. I have tried passing directly string as an argument but even that doesn't work. My first guess is that it is Near/Far pointer problem. I tried using that but code never compiled. Please let me know how to resolve this problem.
Code:
CopyBuf(Pu8Data, &gstUart.stTx.u8Buf[gstUart.stTx.u8BufIndex], u8Len);
CopyBuf((U8*)"AT+IPR=9600\r\n", &gstUart.stTx.u8Buf[gstUart.stTx.u8BufIndex], 13);
void CopyBuf(const U8* Pu8Src, U8* Pu8Dest, U16 u16Len)
{
if((NULL != Pu8Src)&&(NULL != Pu8Dest)&&(u16Len > NULL))
{
while(u16Len)
{
*Pu8Dest = *Pu8Src;
Pu8Dest++;
Pu8Src++;
u16Len--;
}
}
}