Hello All,
I'am using TM4C1294 launchpad and I'am trying to send array of data to my thermal printer for printing. Is It Correct If I use the below command to send the data array using UART ?
for(i=0;i<10;i++)
{
UARTCharPut(UART2_BASE,data[i]);
}
When I send the same data using Arduino , it works like a charm! However When I try sending it with TM4C129 it does not work and prints some gibberish things!
I mentioned Arduino because Initially I test my peripherals using Arduino so that Iam sure that the peripheral works fine
In Arduino there is a function called Serial.write("data") which sends BYTES. I'am sure UARTCharPut(UART2_BASE,data) is equivalent to Arduino Serial.write() or is it NOT??
My arduino code is mentioned below which works fine
val = analogRead(analogPin);
mySensVals[i]=val;
i= i+1;
Serial.write(0xFE);
Serial.write(0x03);
Serial.write(0x01);
Serial.write(0x04);
Serial.write(0x03);
Serial.write(0x05);
Serial.write(0x02);
Serial.write(0x14);
Serial.write(0x06);
Serial.write(0x14);
Serial.write(0xFD);
Serial.write(0xFA);
Serial.write(240);
for(i=0;i<=239;i++)
{
Serial.write(mySensVals[i]);
}
Now my TM4C129 code is shown below which is not printing the same result as the Arduino code
uint8_t CH1therm[11]={0xFE,0x03,0x01,0x04,0x03,0x05,0x02,0x14,0x06,0x14,0xFD};
volatile int32_t CH1thermdata[240];
CH1thermdata[g]=ui32ADC0Value[0];
g=g+1;
if (g==240)
{
g=0;
for(i=0;i<=10;i++)
{
UARTCharPut(UART2_BASE,CH1therm[i]);
}
UARTCharPut(UART2_BASE,0xFA);
UARTCharPut(UART2_BASE,0xF0);
for(i=0;i<=239;i++)
{
UARTCharPut(UART2_BASE,CH1thermdata[i]);
}
}
Kindly suggest some solution for this!!