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. serial comm in w2k (please help!!!)

serial comm in w2k (please help!!!)

Scheduled Pinned Locked Moved C / C++ / MFC
helphardwarequestion
10 Posts 6 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.
  • N Offline
    N Offline
    n 0
    wrote on last edited by
    #1

    i posted this already once, but it seems like nobody noticed it... this is really important and urgent... i need help with my timeouts. i can get my program to read/write single bytes, but the problem is a function related with the hardware i'm using. you send the command and the hardware will enter a loop sending you each 3ms 7 bytes. i can't set the timeouts properly in order to receive all those bytes (the most important thing is that i don't loose any bytes!)... can anybody please help me?? thank you in advance... Я люблю русский языкь!

    D T 2 Replies Last reply
    0
    • N n 0

      i posted this already once, but it seems like nobody noticed it... this is really important and urgent... i need help with my timeouts. i can get my program to read/write single bytes, but the problem is a function related with the hardware i'm using. you send the command and the hardware will enter a loop sending you each 3ms 7 bytes. i can't set the timeouts properly in order to receive all those bytes (the most important thing is that i don't loose any bytes!)... can anybody please help me?? thank you in advance... Я люблю русский языкь!

      D Offline
      D Offline
      D J Deky
      wrote on last edited by
      #2

      ...it is not clear whether you use API or something else on PC side??? pozdrav

      N 1 Reply Last reply
      0
      • N n 0

        i posted this already once, but it seems like nobody noticed it... this is really important and urgent... i need help with my timeouts. i can get my program to read/write single bytes, but the problem is a function related with the hardware i'm using. you send the command and the hardware will enter a loop sending you each 3ms 7 bytes. i can't set the timeouts properly in order to receive all those bytes (the most important thing is that i don't loose any bytes!)... can anybody please help me?? thank you in advance... Я люблю русский языкь!

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        oh oh, i already saw that post yesterday :omg: :-D:suss::cool::doh: sorry, i've got no answer to help you


        TOXCCT >>> GEII power

        1 Reply Last reply
        0
        • D D J Deky

          ...it is not clear whether you use API or something else on PC side??? pozdrav

          N Offline
          N Offline
          n 0
          wrote on last edited by
          #4

          i use CreateFile(), ReadFile(), WriteFile() && CloseHandle(). i set the timeout values with setcommtimeouts Я люблю русский языкь!

          D 1 Reply Last reply
          0
          • N n 0

            i use CreateFile(), ReadFile(), WriteFile() && CloseHandle(). i set the timeout values with setcommtimeouts Я люблю русский языкь!

            D Offline
            D Offline
            D J Deky
            wrote on last edited by
            #5

            ...if I understand properly, you want the synchronization based on your external hardware event, which signs the beegining of transfer and you want starting timeout than. If this scenario is corect you should try with DCB and COMSTAT structure and settings of fCtsHold, fDsrHold etc. to inform your PC about e3xternal events. SetCommState() and GetCommState() are useful functions, too. But this approach needs mutithreading and synchronization, but it is worth of effort........ pozdrav

            N 1 Reply Last reply
            0
            • D D J Deky

              ...if I understand properly, you want the synchronization based on your external hardware event, which signs the beegining of transfer and you want starting timeout than. If this scenario is corect you should try with DCB and COMSTAT structure and settings of fCtsHold, fDsrHold etc. to inform your PC about e3xternal events. SetCommState() and GetCommState() are useful functions, too. But this approach needs mutithreading and synchronization, but it is worth of effort........ pozdrav

              N Offline
              N Offline
              n 0
              wrote on last edited by
              #6

              no, no... these are the 7 bytes i get ach 3ms: byte1 byte2 byte3 ... ID data1 data2 ... each frame begins with 0x37 - thats the id that tells me where i may begin with the synchronization. but the problem lies somewhere else: i can't set the reading timeouts (SetCommTimeout()) properly to keep up with those 7 bytes each 3ms... i'm able to keep up for about 10 seconds; each 10 seconds i loose some frames. one of the reason is this very slow computer i'm using... (my program's got to work event on 133MHz machines!) Я люблю русский языкь!

              A L J 3 Replies Last reply
              0
              • N n 0

                no, no... these are the 7 bytes i get ach 3ms: byte1 byte2 byte3 ... ID data1 data2 ... each frame begins with 0x37 - thats the id that tells me where i may begin with the synchronization. but the problem lies somewhere else: i can't set the reading timeouts (SetCommTimeout()) properly to keep up with those 7 bytes each 3ms... i'm able to keep up for about 10 seconds; each 10 seconds i loose some frames. one of the reason is this very slow computer i'm using... (my program's got to work event on 133MHz machines!) Я люблю русский языкь!

                A Offline
                A Offline
                Anonymous
                wrote on last edited by
                #7

                i couldn't understand your question please give some clarification. if your hardware support XON OXFF you can try this. otherwise. let your Read thread get Higher Priority than other thread. i hope it will help u.

                1 Reply Last reply
                0
                • N n 0

                  no, no... these are the 7 bytes i get ach 3ms: byte1 byte2 byte3 ... ID data1 data2 ... each frame begins with 0x37 - thats the id that tells me where i may begin with the synchronization. but the problem lies somewhere else: i can't set the reading timeouts (SetCommTimeout()) properly to keep up with those 7 bytes each 3ms... i'm able to keep up for about 10 seconds; each 10 seconds i loose some frames. one of the reason is this very slow computer i'm using... (my program's got to work event on 133MHz machines!) Я люблю русский языкь!

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  i couldn't understand your question please give some clarification. if your hardware support XON OXFF you can try this. otherwise. let your Read thread get Higher Priority than other thread. i hope it will help u.

                  1 Reply Last reply
                  0
                  • N n 0

                    no, no... these are the 7 bytes i get ach 3ms: byte1 byte2 byte3 ... ID data1 data2 ... each frame begins with 0x37 - thats the id that tells me where i may begin with the synchronization. but the problem lies somewhere else: i can't set the reading timeouts (SetCommTimeout()) properly to keep up with those 7 bytes each 3ms... i'm able to keep up for about 10 seconds; each 10 seconds i loose some frames. one of the reason is this very slow computer i'm using... (my program's got to work event on 133MHz machines!) Я люблю русский языкь!

                    J Offline
                    J Offline
                    jhwurmbach
                    wrote on last edited by
                    #9

                    фил wrote: each 10 seconds i loose some frames. one of the reason is this very slow computer i'm using... You may need to resort to a device-driver if you really need to work on very slow computers. If you are working on a real OS, that is something NT-based, you could try a service with a higher priority, if needed. I think the problem is not so much the speed of your PC. That sould be sufficient for a task like this. I suspect the Windows introduced lack of reproducability of the reaction time.


                    "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                    N 1 Reply Last reply
                    0
                    • J jhwurmbach

                      фил wrote: each 10 seconds i loose some frames. one of the reason is this very slow computer i'm using... You may need to resort to a device-driver if you really need to work on very slow computers. If you are working on a real OS, that is something NT-based, you could try a service with a higher priority, if needed. I think the problem is not so much the speed of your PC. That sould be sufficient for a task like this. I suspect the Windows introduced lack of reproducability of the reaction time.


                      "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                      N Offline
                      N Offline
                      n 0
                      wrote on last edited by
                      #10

                      it thought of writing myself a device driver, too; but then i thought of some cheap programs that used to work for win95 and they managed to do well without any ddk. and besides that, you got software and hardware fifos you can setup to whatever size you need so even when you're synchronizing with the frames on a very slow machine it should be enough picking up some KBs each 10, 20, ...60 secs to keep up... i think one must be able to fix this by altering the timeouts... maybe you got some other ideas... thanks Я люблю русский языкь!

                      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