Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Thread Initialisation.......

Thread Initialisation.......

Scheduled Pinned Locked Moved Mobile
helpc++hardware
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Deepa Gopal
    wrote on last edited by
    #1

    :confused:Hi All, I have a problem in my embedded VC++ which is as follows: There is a Read Thread created during WM_CREATE event, which is supposed to read data from the COM1 port as and when it receives data.I have created the thread in such a way that it is active right from the point of creation - hReadThread = CreateThread (NULL, 0, PortRead, 0, 0, &dwThreadId); The problem is I dont know why the data is not read from COM1 though the read thread is active right from start. It would be very helpful if you could kindly help em out. Thanx Deepa.

    D 1 Reply Last reply
    0
    • D Deepa Gopal

      :confused:Hi All, I have a problem in my embedded VC++ which is as follows: There is a Read Thread created during WM_CREATE event, which is supposed to read data from the COM1 port as and when it receives data.I have created the thread in such a way that it is active right from the point of creation - hReadThread = CreateThread (NULL, 0, PortRead, 0, 0, &dwThreadId); The problem is I dont know why the data is not read from COM1 though the read thread is active right from start. It would be very helpful if you could kindly help em out. Thanx Deepa.

      D Offline
      D Offline
      Daniel Strigl
      wrote on last edited by
      #2

      Show us how do you read the data from the COM1 port in your thread! Regards, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

      D 1 Reply Last reply
      0
      • D Daniel Strigl

        Show us how do you read the data from the COM1 port in your thread! Regards, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

        D Offline
        D Offline
        Deepa Gopal
        wrote on last edited by
        #3

        Hi, This i how I read the data: SetCommMask (hSerial1, EV_RXCHAR | EV_TXEMPTY |EV_CTS | EV_DSR | EV_RLSD | EV_RING); WaitCommEvent (hSerial1, &dwCommModemStatus, 0); SetCommMask (hSerial1, EV_RXCHAR | EV_TXEMPTY |EV_CTS | EV_DSR | EV_RLSD | EV_RING); if (dwCommModemStatus & (EV_RXCHAR | EV_RLSD | EV_TXEMPTY |EV_CTS | EV_DSR | EV_RING) ) { do { flag = ReadFile(hSerial1,&response, 1, &dwBytesTransferred, NULL); if (flag) { //Process Data } } while(dwBytesTransferred == 1); } Thanx Deepa

        D 1 Reply Last reply
        0
        • D Deepa Gopal

          Hi, This i how I read the data: SetCommMask (hSerial1, EV_RXCHAR | EV_TXEMPTY |EV_CTS | EV_DSR | EV_RLSD | EV_RING); WaitCommEvent (hSerial1, &dwCommModemStatus, 0); SetCommMask (hSerial1, EV_RXCHAR | EV_TXEMPTY |EV_CTS | EV_DSR | EV_RLSD | EV_RING); if (dwCommModemStatus & (EV_RXCHAR | EV_RLSD | EV_TXEMPTY |EV_CTS | EV_DSR | EV_RING) ) { do { flag = ReadFile(hSerial1,&response, 1, &dwBytesTransferred, NULL); if (flag) { //Process Data } } while(dwBytesTransferred == 1); } Thanx Deepa

          D Offline
          D Offline
          Daniel Strigl
          wrote on last edited by
          #4

          Are you shure that the thread started correctly? Just show a message box when the thread is started. Just try to read some data from the COM outside of the thread, to see if the serial communication work! PS: I use the Serial library for C++ library (with some little changes that it will compile under eVC++) for my serial communication! Regards, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

          D 1 Reply Last reply
          0
          • D Daniel Strigl

            Are you shure that the thread started correctly? Just show a message box when the thread is started. Just try to read some data from the COM outside of the thread, to see if the serial communication work! PS: I use the Serial library for C++ library (with some little changes that it will compile under eVC++) for my serial communication! Regards, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

            D Offline
            D Offline
            Deepa Gopal
            wrote on last edited by
            #5

            Hi all, Thanx a lot for the replies.The Read Thread works fine now.Apparently there was a problem with the firmware. Thanx again:):)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups