Reading parallel port with constant sample rate

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter

    Reading parallel port with constant sample rate

    I'm interested to know what ideas are out there for reading a parallel port at a constant sample rate while still allowing the user to interact with the GUI. That is, reading it every 10ms for example without exception. Is this at all possible?

    Current tests done show that if the sample rate is 10ms then this is acheived in general, but when another program loads or terminates this 10ms jumps up to 100ms or more. In these tests the code is placed in a Do Loop with Application.DoE vents and when the code is placed in a seperate thread in a Do Loop with Thread.Sleep(10 ). During this temporary 100ms there will be significant data loss.

    Is it possible to acheive this real-time goal on a Windows OS with VB.Net?

  • Imran Koradia

    #2
    Re: Reading parallel port with constant sample rate

    Its possible under windows but I dont think its a possibility under vb .net
    or for that matter in .net altogether. I just dont think the .net runtime is
    deterministic enough to allow development of real-time applications
    especially now that it has the non-deterministic garbage collector. You
    might want to look at developing such applications in C/C++ or some
    third-party real-time module for windows depending on how much of a need
    this is to you. Here are some links:





    hope this helps..

    "Peter" <Peter@discussi ons.microsoft.c om> wrote in message
    news:3D43A0CD-E6CB-487D-912B-3652AC0A178C@mi crosoft.com...[color=blue]
    > I'm interested to know what ideas are out there for reading a parallel[/color]
    port at a constant sample rate while still allowing the user to interact
    with the GUI. That is, reading it every 10ms for example without exception.
    Is this at all possible?[color=blue]
    >
    > Current tests done show that if the sample rate is 10ms then this is[/color]
    acheived in general, but when another program loads or terminates this 10ms
    jumps up to 100ms or more. In these tests the code is placed in a Do Loop
    with Application.DoE vents and when the code is placed in a seperate thread
    in a Do Loop with Thread.Sleep(10 ). During this temporary 100ms there will
    be significant data loss.[color=blue]
    >
    > Is it possible to acheive this real-time goal on a Windows OS with VB.Net?
    >[/color]


    Comment

    • Peter

      #3
      Re: Reading parallel port with constant sample rate

      Thanks for your feedback. Do you think it is possible to write a module (in a real-time 3rd party product) for scanning the parallel port at a specified sample rate and raising an event within a .NET application when a certain condition is met?

      "Imran Koradia" wrote:
      [color=blue]
      > Its possible under windows but I dont think its a possibility under vb .net
      > or for that matter in .net altogether. I just dont think the .net runtime is
      > deterministic enough to allow development of real-time applications
      > especially now that it has the non-deterministic garbage collector. You
      > might want to look at developing such applications in C/C++ or some
      > third-party real-time module for windows depending on how much of a need
      > this is to you. Here are some links:
      > http://www.merl.com/reports/docs/TR98-02.pdf
      > http://sys-con.com/story/?storyid=45500&DE=1
      > http://www.tenasys.com/intime.html
      > http://www.engineeringtalk.com/news/nem/nem108.html
      >
      > hope this helps..
      >
      > "Peter" <Peter@discussi ons.microsoft.c om> wrote in message
      > news:3D43A0CD-E6CB-487D-912B-3652AC0A178C@mi crosoft.com...[color=green]
      > > I'm interested to know what ideas are out there for reading a parallel[/color]
      > port at a constant sample rate while still allowing the user to interact
      > with the GUI. That is, reading it every 10ms for example without exception.
      > Is this at all possible?[color=green]
      > >
      > > Current tests done show that if the sample rate is 10ms then this is[/color]
      > acheived in general, but when another program loads or terminates this 10ms
      > jumps up to 100ms or more. In these tests the code is placed in a Do Loop
      > with Application.DoE vents and when the code is placed in a seperate thread
      > in a Do Loop with Thread.Sleep(10 ). During this temporary 100ms there will
      > be significant data loss.[color=green]
      > >
      > > Is it possible to acheive this real-time goal on a Windows OS with VB.Net?
      > >[/color]
      >
      >
      >[/color]

      Comment

      • One Handed Man \( OHM - Terry Burns \)

        #4
        Re: Reading parallel port with constant sample rate

        Parallel ports are synchronous, therefore you should not be able to 'loose'
        data. For example, when you scan a document in using a paralell port, and
        start other applications, do you loose data ? No!

        It is a case of writing a driver to interact with the port, not an
        insignificant task, but do-able.

        --

        OHM ( Terry Burns )
        . . . One-Handed-Man . . .

        Time flies when you don't know what you're doing

        "Peter" <Peter@discussi ons.microsoft.c om> wrote in message
        news:3D43A0CD-E6CB-487D-912B-3652AC0A178C@mi crosoft.com...[color=blue]
        > I'm interested to know what ideas are out there for reading a parallel[/color]
        port at a constant sample rate while still allowing the user to interact
        with the GUI. That is, reading it every 10ms for example without exception.
        Is this at all possible?[color=blue]
        >
        > Current tests done show that if the sample rate is 10ms then this is[/color]
        acheived in general, but when another program loads or terminates this 10ms
        jumps up to 100ms or more. In these tests the code is placed in a Do Loop
        with Application.DoE vents and when the code is placed in a seperate thread
        in a Do Loop with Thread.Sleep(10 ). During this temporary 100ms there will
        be significant data loss.[color=blue]
        >
        > Is it possible to acheive this real-time goal on a Windows OS with VB.Net?
        >[/color]


        Comment

        • Peter

          #5
          Re: Reading parallel port with constant sample rate

          What if the parallel port was being written to (by an external device) every couple of milliseconds? Not sampling the data at a constant rate will miss data.

          Any suggestions?

          "One Handed Man ( OHM - Terry Burns )" wrote:
          [color=blue]
          > Parallel ports are synchronous, therefore you should not be able to 'loose'
          > data. For example, when you scan a document in using a paralell port, and
          > start other applications, do you loose data ? No!
          >
          > It is a case of writing a driver to interact with the port, not an
          > insignificant task, but do-able.
          >
          > --
          >
          > OHM ( Terry Burns )
          > . . . One-Handed-Man . . .
          >
          > Time flies when you don't know what you're doing
          >
          > "Peter" <Peter@discussi ons.microsoft.c om> wrote in message
          > news:3D43A0CD-E6CB-487D-912B-3652AC0A178C@mi crosoft.com...[color=green]
          > > I'm interested to know what ideas are out there for reading a parallel[/color]
          > port at a constant sample rate while still allowing the user to interact
          > with the GUI. That is, reading it every 10ms for example without exception.
          > Is this at all possible?[color=green]
          > >
          > > Current tests done show that if the sample rate is 10ms then this is[/color]
          > acheived in general, but when another program loads or terminates this 10ms
          > jumps up to 100ms or more. In these tests the code is placed in a Do Loop
          > with Application.DoE vents and when the code is placed in a seperate thread
          > in a Do Loop with Thread.Sleep(10 ). During this temporary 100ms there will
          > be significant data loss.[color=green]
          > >
          > > Is it possible to acheive this real-time goal on a Windows OS with VB.Net?
          > >[/color]
          >
          >
          >[/color]

          Comment

          • Dick Grier

            #6
            Re: Reading parallel port with constant sample rate

            Hi,
            [color=blue][color=green]
            >>[/color][/color]
            Is it possible to acheive this real-time goal on a Windows OS with VB.Net?
            <<

            In general, no. Windows is not a real-time OS, and .NET is far from a
            real-time programming environment, even if Windows were RT.

            However, depending on what your "real" goals are, it often is possible it
            approach RT in an application. Certainly, 10 mS for accessing a parallel
            port is reasonable. However, at the boundaries of operation you may see
            results that lie outside this "window." For more information you may want
            to look a the PC Data Acquisition link on my homepage. It has some
            discussion of RT issues.

            BTW, thread.sleep put your thread to sleep for AT LEAST 10 mS, not for
            EXACTLY 10 mS. A more reasonable approach (IMO) would be to use a threading
            timer, and to provide some sort of internal correction mechanism that checks
            on elapsed time.

            Dick

            --
            Richard Grier (Microsoft Visual Basic MVP)

            See www.hardandsoftware.net for contact information.

            Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
            Edition ISBN 1-890422-27-4 (391 pages) published February 2002.


            Comment

            • Dick Grier

              #7
              Re: Reading parallel port with constant sample rate

              If you absolutely cannot afford to miss ANY data, then you cannot use
              Windows or .NET. You must use a RT OS and compatible language.

              --
              Richard Grier (Microsoft Visual Basic MVP)

              See www.hardandsoftware.net for contact information.

              Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
              Edition ISBN 1-890422-27-4 (391 pages) published February 2002.


              Comment

              Working...