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. General Programming
  3. C / C++ / MFC
  4. Using Serial Port communication for dialog based application

Using Serial Port communication for dialog based application

Scheduled Pinned Locked Moved C / C++ / MFC
beta-testinghelpquestioncode-review
4 Posts 3 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.
  • B Offline
    B Offline
    BeakX
    wrote on last edited by
    #1

    I am currently try to do a dialog based application using the serial port to communicate and control some equipment. However, i find that the behaviour of the windows dialog based application is different from the win32 console application which i written. The win32 application was able to send all instructions and read all the recieved transmission without error. However, when i used back the same functions and write back an almost similar program for my dialog based application, some of the instructions were not sent properly thru the serial port and the recieved transmissions were not read properly. I managed to solve the program of reading the recieved transmission by purging the port before i send an instruction that expect the feedback. However, the dialog based application still causes the equipment to act with a delay, unlike its win32 counter part. My quesitons are: 1) Why is it for the dialog based application i need to purge the port before i expect a feedback in order to read my feedback properly (but i dont have to do so for the win32 app) ? 2) Is there a difference in using serial port for win32 console apps and dialog based apps ?

    C 1 Reply Last reply
    0
    • B BeakX

      I am currently try to do a dialog based application using the serial port to communicate and control some equipment. However, i find that the behaviour of the windows dialog based application is different from the win32 console application which i written. The win32 application was able to send all instructions and read all the recieved transmission without error. However, when i used back the same functions and write back an almost similar program for my dialog based application, some of the instructions were not sent properly thru the serial port and the recieved transmissions were not read properly. I managed to solve the program of reading the recieved transmission by purging the port before i send an instruction that expect the feedback. However, the dialog based application still causes the equipment to act with a delay, unlike its win32 counter part. My quesitons are: 1) Why is it for the dialog based application i need to purge the port before i expect a feedback in order to read my feedback properly (but i dont have to do so for the win32 app) ? 2) Is there a difference in using serial port for win32 console apps and dialog based apps ?

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      First, win32 console applications doesn't exist. It is either a console application or either a win32 application. Second, there will be no difference between how the serial port is handled in both cases. You probably did something wrong. Maybe post some code and explai us what exactly the problem is.

      R 1 Reply Last reply
      0
      • C Cedric Moonen

        First, win32 console applications doesn't exist. It is either a console application or either a win32 application. Second, there will be no difference between how the serial port is handled in both cases. You probably did something wrong. Maybe post some code and explai us what exactly the problem is.

        R Offline
        R Offline
        Rick York
        wrote on last edited by
        #3

        "First, win32 console applications doesn't exist." WRONG. Win32 console applications DO exist. There is a set of functions specifically for Win32 console apps which can be found at the MSDN website in a section titled "Win32 and COM Development" : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_functions.asp[^] These functions are declared in WinCon.h and they reside in Kernel32.lib which are a win32 header and a win32 library respectively.

        C 1 Reply Last reply
        0
        • R Rick York

          "First, win32 console applications doesn't exist." WRONG. Win32 console applications DO exist. There is a set of functions specifically for Win32 console apps which can be found at the MSDN website in a section titled "Win32 and COM Development" : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_functions.asp[^] These functions are declared in WinCon.h and they reside in Kernel32.lib which are a win32 header and a win32 library respectively.

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          But it is still a console app. It is not because you make calls to some functionalities of the Win32 API that your application becomes a WIN32 application. Or am I wrong ?

          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