Impulses at the serial port - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Impulses at the serial port

Hello & Greetz from Germany!

At first, please, excuse my surely horrible English, thanks.

I'm quite a Newbie on programming in C++ using the Borland C++-Builder (Ver. 4) under Win95 and I want to remake a project which I made with TurboPascal some time ago...

I've a selfmade sensor on a serial port, that gives impulses in a frequency of 15 to 750 Hz to the RingIndicator (register offset+6, bit 6). It's a very simple sensor, just an oscillator with an OP, so, there's no built-in interface or a controller using the known protocols on data-I/O, like Kermit, Xmodem or things like that. In fact, there is also no baudrate, parity or word-length to use. The supply-voltage is given by DTR and RTS (offset+4, bit 0 + 1).

To the program: I want to count the incoming impulses on the RS232 and evaluate these every 5 or 6 seconds. In my Pascal-Program, under pure MS-DOS it works more then fine, in a fantastic way, but it's only monotasking. Now I try to realize it in a similar way under Win95. It's no problem to take acces on the ports by using DLPortIO (freeware: http://diskdude.cjb.net/), but it's no good to use while-loops, like the way I tried; the whole OS is busy, nothing works in a correct way and even the impulse-counting has errors. I'm at the beginning, I don't use any threads, ignore any interrupts, and some questions to other forums just gave back, that it's very heavy to realize satisfactorily.

But I guess, it's possibly! It should work like the mouse, in the background, without taking all performance of the OS. But how? Should I write a thread? Should I use an interrupt? Why using the total performance of the CPU? I only want to register the impulses and query them every some seconds. Must I dive into assembler? Or could I solve all my problems by programming the UART of the RS232 to use it's interrupt-possibility? Do I use the wrong component? Is there a shell by Windows on the hardware access?

How would YOU write a mouse-application without using the standard mouse programs given by microsoft?

Many questions, any answers?

I hope so and I say THANK YOU to everybody making her/his thoughts on my questions!

Nice greetings...

Hubi

Comments

  • melissa_may1melissa_may1 Posts: 937Member
    : Hello & Greetz from Germany!
    :
    : At first, please, excuse my surely horrible English, thanks.
    :
    : I'm quite a Newbie on programming in C++ using the Borland C++-Builder (Ver. 4) under Win95 and I want to remake a project which I made with TurboPascal some time ago...
    :
    : I've a selfmade sensor on a serial port, that gives impulses in a frequency of 15 to 750 Hz to the RingIndicator (register offset+6, bit 6). It's a very simple sensor, just an oscillator with an OP, so, there's no built-in interface or a controller using the known protocols on data-I/O, like Kermit, Xmodem or things like that. In fact, there is also no baudrate, parity or word-length to use. The supply-voltage is given by DTR and RTS (offset+4, bit 0 + 1).
    :
    : To the program: I want to count the incoming impulses on the RS232 and evaluate these every 5 or 6 seconds. In my Pascal-Program, under pure MS-DOS it works more then fine, in a fantastic way, but it's only monotasking. Now I try to realize it in a similar way under Win95. It's no problem to take acces on the ports by using DLPortIO (freeware: http://diskdude.cjb.net/), but it's no good to use while-loops, like the way I tried; the whole OS is busy, nothing works in a correct way and even the impulse-counting has errors. I'm at the beginning, I don't use any threads, ignore any interrupts, and some questions to other forums just gave back, that it's very heavy to realize satisfactorily.
    :
    : But I guess, it's possibly! It should work like the mouse, in the background, without taking all performance of the OS. But how? Should I write a thread? Should I use an interrupt? Why using the total performance of the CPU? I only want to register the impulses and query them every some seconds. Must I dive into assembler? Or could I solve all my problems by programming the UART of the RS232 to use it's interrupt-possibility? Do I use the wrong component? Is there a shell by Windows on the hardware access?
    :
    : How would YOU write a mouse-application without using the standard mouse programs given by microsoft?
    :
    : Many questions, any answers?
    :
    : I hope so and I say THANK YOU to everybody making her/his thoughts on my questions!
    :
    : Nice greetings...
    :
    : Hubi
    :


    Hi Hubi!

    Your English is fine. Imagine my German!

    I've done a lot of serial I/O in Visual Basic and DOS. In each, I used interrupts. Using a loop to check for RI transition takes too much CPU power.

    The Serial hardware already handles the interrupts, so it shouldn't be too difficult.

    Good luck!




    [purple]Melissa[/purple]

Sign In or Register to comment.