Decoding serial to usefull data

Hi All
I`m new to serial communication.

Started dealing with a display, that is feeding data through the serial.
For the trial purpose Im so far only feeding what page Im on.

The recevied data is;
I received: 170
I received: 120 (This change to 121 when i touch)
I received: 0
I received: 1 (This is the page number. For now only 0 and 1)
I received: 204
I received: 51
I received: 195
I received: 60

On the display datasheet the received data is as follow:
AA <Touch_Code> CC 33 C3 3C

My question is:
Can some one please suggest how to convert this row of values into single reference like page0,page1 and so on?

Thanks in advance for any suggestions

Please post the full sketch that is receiving and printing the data

If the received data should be

AA <Touch_Code> CC 33 C3 3C

and what you see printed is

I received: 170

then there is obviously some parsing of the data already taking place

Note that “AA” (hex) is “170” (decimal) and 33 hex is 51 Dec.
Maybe change your print statements to
Serial.print(c, HEX)

1 Like

No No

I receive all that at once so it does match what the display sends and match what i receive- AA 78 00 10 CC 33 C3 3C
I received: 170 -AA
I received: 120 -78
I received: 0 -00
I received: 1 -01
I received: 204 -CC
I received: 51 -33
I received: 195 -C3
I received: 60 -3C

int incomingByte = 0; // for incoming serial data

void setup() {
  Serial.begin(115200); // opens serial port, sets data rate to 9600 bps
  Serial3.begin(115200);
}

void loop() {
  // send data only when you receive data:
  if (Serial3.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial3.read();

    // say what you got:
    Serial.print("I received: ");
    Serial.println(incomingByte, HEX);
  }
}

So data is correct, however this is to  my understanding this is 8 bit of data at once and I`m asking how to convert that or use as reference to something like if(page1)==true- do something

Does get that
I received: AA

I received: 78
I received: 0
I received: 1
I received: CC
I received: 33
I received: C3
I received: 3C

If you see

I received: 0
I received: 1

when on pages 0 and 1 respectively then you can do this

void loop()
{
  // send data only when you receive data:
  if (Serial3.available() > 0)
  {
    incomingByte = Serial3.read();
    if (incomingByte == 0)
    {
       Serial.println("page0");
    }
    else if (incomingByte == 1)
    {
       Serial.println("page1");
    }
    Serial.println(incomingByte, HEX);
  }
}

There are smarter ways to do this but give this a try

The problem I see is when for example you get 1 in bit3 and bit8 or another function message. Then you would not be able to use what you suggest.
I was wondering whether I can somehow convert the entire 8 separate values onto one unique either number or character

You are referring to bits but you probably mean bytes

It would help if you posted a link to the display datasheet so that we could see for ourselves what is sent

Appologies for the typo. Yes, 8 bits is being sent as single command.

T5L_TA-AIoT-LCM-Platform-Instruction-Screen-Development-Guide.pdf (1.9 MB)
Attached.

Thanks

I think that you mean 8 bytes, but will check the datasheet

As suspected from your examples and the datasheet it is 8 bytes rather than 8 bits. Do you understand the difference ?

Heyo
8 bits in 1 byte? Or is it opposite?. I could never get the difference.

I am sorry but, if that is your level of knowledge then using this screen is not for you, unless of course you are joking

Please tell me that you are joking

8 bits is 1 byte, basically 00000000 is 1 byte or 255.
Anyways, we are leaving behind my original query.

00000000 is one way of representing the bits of a byte but its value is not 255, so I still don't know what your level of knowledge is.

Judging by the fact that you have created over 100 topics in the forum I would have expected a better level of knowledge

The 256 is reserved but im not sure what for hence 255 is the highest number. Anyway, why Bob? why are we now spaming this post with stuff that isnt relevant and we taking junk rather than achiveing anyting? 7 posts wasted. Whoever now see this won`t be bothered stepping in with assistance.

If you do not get that the odds of the project working successfully is slim. Put this in front of your screen? "8 bits make 1 byte but it takes two bytes to make a word". Do that and in about a week it will no longer be a problem. Try this link for some more information. What are bits, bytes, and other units of measure for digital information?

What we a exchanging posts about is judging your level of understanding so that suitable advice can be provided

Your responses so far, such as

prove to me that you are not ready to understand how to use this screen

Good luck with the project but I feel that I can offer no help towards it

2 Likes

All I asked is how to convert what I received to array. Forget it. Appears I am to dumb for that anyway and that's for helping me finally understand it.

Where did you ask that ?