Reading RAW Data From RS232 Device & Split Them!

here is some code that unpacks the fields based on your description

in many cases you say there is a varying number of bytes in each field. i would have thought each field has an ID byte that may imply the # of data values following. the image you posted presumably from a description of the packet doesn't explain this.

could you post a link to the description of the packet?

          from truck controller   02 06 03 07
                         header   02 4d 32 10 02
            suspension pressure   42 10 02
            suspension pressure   47 10 03
            suspension pressure   8c 05
            suspension pressure   9f 10 03
       inclination of the truck   4b 10 02
                        payload   a7 10 03
                  current speed   00
                       DIG STST   10 02
                          ANA 1   00
                          ANA 2   00
           status of dump truck   10 03

typedef unsigned char byte;

byte msg [] =  {
    0x02, 0x06, 0x03, 0x07,  0x02, 0x4d, 0x32, 0x10,
    0x02, 0x42, 0x10, 0x02,  0x47, 0x10, 0x03, 0x8c,
    0x05, 0x9f, 0x10, 0x03,  0x4b, 0x10, 0x02, 0xa7,
    0x10, 0x03, 0x00, 0x10,  0x02, 0x00, 0x00, 0x10,
    0x03, 0x03, 0x8b
};

struct Blk_s {
    int         idx;
    int         len;
    const char *desc;
};

Blk_s blks [] = {
    {  0, 4, "from truck controller" },
    {  4, 5, "header" },
    {  9, 3, "suspension pressure" },
    { 12, 3, "suspension pressure" },
    { 15, 2, "suspension pressure" },
    { 17, 3, "suspension pressure" },
 
    { 20, 3, "inclination of the truck" },
    { 23, 3, "payload" },

    { 26, 1, "current speed" },
    { 27, 2, "DIG STST" },
    { 29, 1, "ANA 1" },
    { 30, 1, "ANA 2" },
    { 31, 2, "status of dump truck" },
    {  0, 0, "" },
};

#include <stdio.h>

void
decode (
    byte *msg,
    int   nByte )
{
    Blk_s *b = blks;

    for (b = blks; 0 < b->len; b++)  {
        printf (" %30s  ", b->desc);
        for (int n = 0; n < b->len; n++)
            printf (" %02x", msg [b->idx + n]);
        printf ("\n");
    }
}


int main ()
{
    decode (msg, sizeof(msg));
    return 0;
}