Hi and thanks for reading.I'm trying to acces the master PLC of a CAN network using the windows api.It's become a nuisance since i cant' figure this out at all.I will try to be brief since i don't have the source code at hand.
So i'm initializing a handle for the COM1 port with the CreateFile() function.I'm getting the DCB configuration since there is actually another program interfacing with this network which configures the protocol when started.
unsinged long Event;
unsigned long BytesRead;
void* ReadBuff;
HANDLE hPort=CreateFile("COM1",GENERIC_READ,0,FILE_ATTRIBUTE_NORMAL,OPEN_EXISTING,0,0);
SetCommMask(hPort,EV_RXCHAR|EV_CTS|EV_RLSD);
WaitCommEvent(hPort,&Event,0);// this should return .. it doesn't
ReadFile(hPort,ReadBuff,8,&BytesRead,0);
These should be the main steps from what i figured out by now but i can't make anythig to work.I tried the overlapped method still .. nothing.Please guide me.And thanks for the time.