Hi guys.Can you write a program that reads data through a com1 serial port that communicates with a plc using c++ and inline asm instead of the ladder logic interface?
I work at a cinema as a projectionist and the whole booth is automated with a bunch of these monsters through a CAN network.
The PLCs are programmed with a ladder logic interface with which i don't cope to well so before i begin studying the 8250 registers or the win32 functions for i/o i would like to know if i would be getting somewhere using this approach.Many thanks in advance!

The way to communicate through com1 will depend on the operating system. MS-Windows, use CreateFile() to open the com port, then ReadFile() and WriteFile() to read/write to it. See commuications functions for more details.

I don't know a thing about ladder logic because I never programmed a PLC.

Ok thanks sir.I am getting a handle to the com1 port , which i'm sure about because i'm using the FormatMessage() function and it says "Operation completed succesfully".I don't really know of a better way than polling but there's not a single byte comming from that port.

When you open the com port with CreateFile() you can specify a callback function that MS-Windows will call when data arrives at the port. That way you don't have to keep polling it to find out if there is data.

Like in LRESULT CALLBACK WndProc()? Isn't that an infinte loop?

So i will use something like CALLBACK WaitCommEvent()?

So i will use something like CALLBACK WaitCommEvent()?

Yes you can use that, but put it in another thread so that it doesn't block the main program.