This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

show packet

hello dear all, i am working on a project that when i send a hex packet i can show that in my pc by uart. but i cant see the packet it just show zero. i write my code here:

#include <LPC17xx.h>
#include <stdio.h>
#include "uart.h"
        unsigned char j[8];


void Delay (uint32_t Time)
{
    uint32_t i;

    i = 0;
    while (Time--) {
        for (i = 0; i < 5000; i++);
    }
}
void read_uart2(void){
        unsigned char j[8];
        char temp;
        int i=0;
        for (i=0; i<7; i++)
        {
        temp=UART2_GetChar();
        j[i]=temp;
        i++;
        };

}
int main(void)
{
 int i=0 ;
//      unsigned char i[8];
        unsigned char lcd_buf[8];

        SystemInit();
        UART0_Init();
        UART2_Init();
        read_uart2();
    while (1)
          {

                UART2_SendString("-LPC1768 -\r\n");
                UART2_SendString((unsigned char *)lcd_buf);
                sprintf(lcd_buf,"counter: %x %x %x %x %x %x %x %x\r\n\n",j[0],j[1],j[2],j[3],j[4],j[5],j[6],j[7]);
    Delay(4000);
    }
}

0