Impulses at RS232 - Programmers Heaven

Howdy, Stranger!

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

Categories

Impulses at RS232

HubiFHubiF Posts: 9Member
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
Sign In or Register to comment.