jjbabu
12th October 2007, 08:14
hi to all,
i am sending some data through the serial port using the "qextserial port".while sending the data,am converting evrything to ascii values.like this
port->write(QString::QString(":").toAscii());//converted char":" to string and sending
port->write(QString::number(3).toAscii());//converted number to string and sending.
here the data is transmitting like a packet,so i need to calculate check sum for that packet.
the rule we follow to calculate check sum is addition of all ascii values of data which we r sending.
for this i did like bellow,
QString sum;
sum= QString(":").toAscii();
sum=sum+(QString::number(3).toAscii()); ......//like this untill end
my problem is not getting check sum as a single data(like char+char=char)
the output i am getting for above is like in the format of strings concordination(: 3)
how to calculate the checksum plz kindly help me.
thanx in advance
i am sending some data through the serial port using the "qextserial port".while sending the data,am converting evrything to ascii values.like this
port->write(QString::QString(":").toAscii());//converted char":" to string and sending
port->write(QString::number(3).toAscii());//converted number to string and sending.
here the data is transmitting like a packet,so i need to calculate check sum for that packet.
the rule we follow to calculate check sum is addition of all ascii values of data which we r sending.
for this i did like bellow,
QString sum;
sum= QString(":").toAscii();
sum=sum+(QString::number(3).toAscii()); ......//like this untill end
my problem is not getting check sum as a single data(like char+char=char)
the output i am getting for above is like in the format of strings concordination(: 3)
how to calculate the checksum plz kindly help me.
thanx in advance