Hi...
Am facing problem with UART am using PIC24FJ64GA104 and XC16 complier .
I wanted to transmit large array and receive the same from UART but am receiving only junk datas please help me.
This is the function am using for TX/RX and bitmap is the data .
Am facing problem with UART am using PIC24FJ64GA104 and XC16 complier .
I wanted to transmit large array and receive the same from UART but am receiving only junk datas please help me.
This is the function am using for TX/RX and bitmap is the data .
Code:
unsigned char bitmap[104]= {
0x0000,0x0070,0x0000,0x0032,0x0081,0x003E,0x0011,0x000E,
0x0011,0x002E,0x0012,0x000D,0x0011,0x000E,0x0011,0x000E,
0x0011,0x000D,0x0012,0x000D,0x0011,0x000E,0x0011,0x000E,
0x0011,0x000D,0x0012,0x000D,0x0011,0x000E,0x0011,0x000E,
0x0011,0x002E,0x0011,0x000E,0x0011,0x000E,0x0011,0x000D,
0x0012,0x000D,0x0011,0x000E,0x0011,0x000E,0x0011,0x000D,
0x0011,0x000D,0x0011,0x000E,0x0011,0x002E,0x0011,0x000E,
0x0011,0x000E,0x0011,0x000E,0x0011,0x000D,0x0011,0x000D,
0x0011,0x000E,0x0011,0x000E,0x0011,0x000D,0x0011,0x002E,
0x0011,0x000E,0x0011,0x000D,0x0012,0x000D,0x0011,0x000E,
0x0011,0x002E,0x0012,0x000D,0x0011,0x000E,0x0011,0x002E,
0x0012,0x000D,0x0011,0x000E,0x0011,0x000E,0x0011,0x000D,
0x0012,0x002E,0x0011,0x000E,0x0011,0x002E,0x0011,0x0AB9
};
void SerialTransmit(unsigned char *buffer)
{
while(U1STAbits.UTXBF); // wait while TX buffer full
for(i=0; i<104; i++)
{
U1TXREG = buffer[i]; // send single character to transmit buffer
}
while(!U1STAbits.TRMT); // wait for last transmission to finish
}
char SerialReceive(unsigned char *buffer, unsigned int max_size)
{
unsigned int i;
while(!U1STAbits.URXDA); // wait until data available in RX buffer
for(i=0; i< max_size;i++)
{
buffer[i] = U1RXREG;
}
return (*buffer);
}