07-29-2005 01:50 PM
07-29-2005 02:16 PM
07-29-2005 02:21 PM
07-29-2005 02:25 PM
07-29-2005 02:33 PM - edited 07-29-2005 02:33 PM
As AnalogKid2DigitalMan said you do not need for anything to be connected to the serial port in order for the serial port to be configured. Only when you try to write to the serial port or read from the serial port will you get an error. If you get an error during configuration that means that the serial port is not present or that one of the settings is invalid, not that there is not a device connected to the serial port.
By the way, why are you using C to communicate over the serial port from LabVIEW? Serial communication is very easy using the VISA drivers in LabVIEW.
Message Edited by John Rich on 07-29-2005 02:33 PM
07-29-2005 02:33 PM
I am trying to put an extern "C" that i found but C++ is giving me errors because of it
extern "C" _declspec(dllexport) char *OpenSerial(char *Commport);
extern "C" _declspec(dllexport) void send_command(char cmd);
extern "C" _declspec(dllexport) char *CloseSerial(void);
07-29-2005 02:36 PM
07-29-2005 02:40 PM
07-29-2005 02:42 PM
HERE is my erase code:
DWORD iBytesWritten;
DWORD iBytesRead;
BOOL bWriteRC;
BOOL bReadRC;
char *sBuffer;
bWriteRC = WriteFile(a,"E\r",2,&iBytesWritten,NULL);
if (bWriteRC){
; //do nothing
}
else
return "Cannot Erase the Flash";
bReadRC = ReadFile(a,&sBuffer,20,&iBytesRead,NULL);
if (bReadRC){
return sBuffer; //do nothing
}
else
return "Cannot Read the Flash";