Freebasic Serial Port Programming

Thank you, I do have an old Automotive scanner that I was able to port some code from to connect to the ECU. It is the following code that I am having a hard time converting. Serial Port Monitor/Logger. I've downloaded Freebasic and want to try to write a program that will open com1. Does anyone know where some serial port.

Hi,
I am new to this board and I am not a very experienced Basic programmer.
I am trying to read and count a pulse train from the serial port. The code looks like this:
INPUT 'ENTER PULSE COUNT'; P%
PIN = &H3F8: REM COM1 PORT ADDRESSFreebasic
DO
IN1=-((INP(PIN + 6) AND 128) = 128): REM READ INPUT PIN 1
IF IN1 = 1 THEN NR =1 ELSE NR=0

Visual Basic Serial Port Programming

NR=NR+1
LOOP UNTIL NR = P%Communication
********************************

Windows Serial Port Programming Example


It does not work. Is this because the pulse train is to fast? The pulses have a period of 0.15ms which is 5kHz and and are 12V, or is the programming wrong?
Freebasic Serial Port Programming

Serial Port Programming In C#

Any suggestins will be greatly appreciated.

Serial Port Communication

Thanks.