Serial Port Communcation - Fluke 289 Meter

I'm having trouble receiving data from my Fluke 289 when communicating through a serial port. I can query the device and it is sending back information but I'm only capturing a portion of the information. The device information says that the Response Syntax is CMD_ACK<CR> READING_VALUE, UNIT, STATE, ATTRIBUTE <CR>.

Any help would be greatly appreciated


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  	//Sending Message to Fluke
	char data[] = "qm\r";
	int size = strlen(data);
	DWORD dwWritten = 0;
	DWORD dwReading = 0;
	WriteFile(Fluke, data, size, &dwWritten, NULL);

	//Reciving Message from Fluke
	char datarecv[4];
	
	ReadFile(Fluke, &datarecv[0], 2, &dwReading, NULL);
	ReadFile(Fluke, &datarecv[1], 2, &dwReading, NULL);
	ReadFile(Fluke, &datarecv[2], 2, &dwReading, NULL);
	ReadFile(Fluke, &datarecv[3], 2, &dwReading, NULL);

	cout << datarecv[0];
	cout << datarecv[1];
	cout << datarecv[2];
	cout << datarecv[3];
The point is that the reading is faster than the serial port can provide that data. You need to repeat the reading until you get the whole data.

You might even pause for a couple of milliseconds with sleep_for(...) :

http://www.cplusplus.com/reference/thread/this_thread/sleep_for/
Last edited on
Topic archived. No new replies allowed.