Results 1 to 13 of 13

Thread: sending command to IC magnetic card reader through serial port e.g command 0x03

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    What You want to send : one byte with value 0x32 or four characters 0,x,3,2 ?

  2. #2
    Join Date
    Jul 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    Quote Originally Posted by Lesiok View Post
    What You want to send : one byte with value 0x32 or four characters 0,x,3,2 ?
    one byte with value 0x32

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    So just use method putChar(char c). QExtSerialPort is a descendant of QIODevice class.

  4. #4
    Join Date
    Jul 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    Quote Originally Posted by Lesiok View Post
    So just use method putChar(char c). QExtSerialPort is a descendant of QIODevice class.
    iget the following error in this code part
    Qt Code:
    1. char vf="0x00";
    2. putchar(vf);
    3. QByteArray commands;
    4. ports->write(putchar(0x00));
    To copy to clipboard, switch view to plain text mode 
    D:\Qt\embedded-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\embedded\mainwindow.c pp:120: error: invalid conversion from 'const char*' to 'char'

    D:\Qt\embedded-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\embedded\mainwindow.c pp:123: error: invalid conversion from 'int' to 'const char*'
    D:\Qt\embedded-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\embedded\mainwindow.c pp:123: error: initializing argument 1 of 'QByteArray::QByteArray(const char*)'


    Added after 15 minutes:


    Quote Originally Posted by hezbon View Post
    iget the following error in this code part
    Qt Code:
    1. char vf="0x00";
    2. putchar(vf);
    3. QByteArray commands;
    4. ports->write(putchar(0x00));
    To copy to clipboard, switch view to plain text mode 
    D:\Qt\embedded-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\embedded\mainwindow.c pp:120: error: invalid conversion from 'const char*' to 'char'

    D:\Qt\embedded-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\embedded\mainwindow.c pp:123: error: invalid conversion from 'int' to 'const char*'
    D:\Qt\embedded-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\embedded\mainwindow.c pp:123: error: initializing argument 1 of 'QByteArray::QByteArray(const char*)'
    please dont look at the error i have done this and no error has been realized sorry i gotten rid of the errors here is my new code.
    Qt Code:
    1. ports->putChar(0x00);
    To copy to clipboard, switch view to plain text mode 
    now my problem is the lcd display is 8x6 matrix and is connected via serial and by default it displays a,b,c,d,..i and now i want to display my data using my laptop from my programm and am using serial to usb converter, when i send the above, i should see something because there is that command for the gadget, i want to do a heads up display of the number of people in a department, but after sending the command nothing clearly happens.


    Added after 21 minutes:


    please dont look at the error i have done this and no error has been realized sorry i gotten rid of the errors here is my new code.
    Qt Code:
    1. ports->putChar(0x00);
    To copy to clipboard, switch view to plain text mode 
    now my problem is the lcd display is 8x6 matrix and is connected via serial and by default it displays a,b,c,d,..i and now i want to display my data using my laptop from my programm and am using serial to usb converter, when i send the above, i should see something because there is that command for the gadget, i want to do a heads up display of the number of people in a department, but after sending the command nothing clearly happens.
    Last edited by hezbon; 19th July 2012 at 09:31.

  5. #5
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    I think you have some documentation for this display. Read it.

  6. #6
    Join Date
    Jul 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    Quote Originally Posted by Lesiok View Post
    I think you have some documentation for this display. Read it.
    funnily enough the supplier never gave the documentation of the device. i have looked at it and i got a chinese which i translated to english but images could not be displayed, i dont know whether it is within my code or the serial lcd but if anyone can know a better lcd to display plz tell so that i buy it.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: sending command to IC magnetic card reader through serial port e.g command 0x03

    I don't quite understand why you're asking on a forum dedicated to Qt how to use some 3rd party hardware device...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 10th July 2010, 17:34
  2. serial port printer sending commands, how?
    By triperzonak in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2009, 14:51
  3. sending QImage over serial port
    By yagabey in forum Qt Programming
    Replies: 5
    Last Post: 16th January 2008, 21:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.