[Qt-interest] enter key event to serial communication

Arnold Krille arnold at arnoldarts.de
Mon Feb 22 10:19:00 CET 2010


On Monday 22 February 2010 09:20:19 Yuvraj wrote:
> Arnold Krille wrote:
> > On Monday 22 February 2010 07:39:22 Yuvraj wrote:
> >> Bradley T. Hughes wrote:
> >>> On 02/19/2010 02:56 PM, Yuvraj wrote:
> >>>> Hi all
> >>>>
> >>>> How do i send a enter key event to serial communication devices?
> >>>
> >>> No offense, I don't see how this relates to Qt? Perhaps your question
> >>> is best asked somewhere else (like a forum/mailing-list/news-group
> >>> that specializes in serial communications?)
> >>
> >> No, my problem is sending enter key value(  QT  related). when i am
> >> pressing the push-button i am doing below mentioned task..
> >>
> >> QString crlf;
> >>     crlf = 0x0d;  // enter key value
> >>     QString data1 = ui->send_text->text().append(crlf);
> >>     com.writeData(data1.toLatin1(),100);
> >>      ui->send_text->clear();
> >>
> >> but in receiver side it is waiting for enter key value ,once it get
> >> enter key value , Then only it will do something
> >
> > Is "com" a QFile accessing the serial device? Then call "com.flush()" to
> > make sure the data is written...
> > But why are you doing "com.writeData( ..., 100 )" ? Surely your string
> > isn't 100 chars long? Better do:
> >
> > QByteArray data1 = ui->send_text->text().toLatin1();
> > data1.append(crlf);
> > com.writeData(data1);
> > com.flush();
> > ui->send_text->clear();
> >
> > And maybe your crlf has the wrong value. Sometimes you can't even trust
> > the documentation, I have seen devices only working with lf or crlf when
> > the docs stated that it needs cr as line-end.
>
> Always i am getting some garbage value  at receiver side

Garbage means a) wrong wiring (if it is more then two-cables) or b) wrong line 
setup, that is wrong speed, wrong stop-bits, wrong parity...

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100222/f4ae07e3/attachment.bin 


More information about the Qt-interest-old mailing list