I need sample code that enables RS-232 communcation via Camera Link. I wrote code that searches for all COM ports. opens each port, sends a camera command, and waits for a response. I am opening each port as if it was a standard RS-232; is this a bad assumption? Any help would be appreciated. Thanks.
I am trying to communicate with an NI PCI-1429e card. I verified that I can do this with a 3rd-party program whose source I do not have, and I need to duplicate this functionality in my VC++ code. As far as I can tell, the command is not being sent. Referring to the code below, nSent=0 is displayed in my diagnostic text box. I verified video with the Measurement & Automation program, but I did not see any capability to set parameters via RS-232. Any guidance would be greatly appreciated.
// Create the event that needs to be signaled when we // wish to stop the acquisition. HStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!HStopEvent) return ;
// Create the thread that is responsible for shutting // down the acquisition HStopThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) StopThread, (LPDWORD) &HStopEvent, 0, &dwThreadId); if (!HStopThread) return ;
// Get the interface name GetWindowText(HIntfName, name, 64);
// Get the interface name // GetWindowText(HIntfName, name, 64) ; errChk(imgInterfaceOpen(name, &Iid)) ; // Verified that Sid and Iid look reasonable errChk(imgSessionOpen(Iid, &Sid)) ;
errChk(imgGetAttribute (Sid, IMG_ATTR_GETSERIAL, &nSerial)) ; // Also verified that nSerial looks reasonable
The serial communication on the framegrabber is not going to be directly accessable through a standard COM port. You can access the camera attributes through serial but this is done with our Vision Software. If you just open a standard COM port and try to talk to the framegrabber it will not work. I would suggest using the IMAQ drivers.