Test and Measurement Forum

PT104 PT100 Protocol

Post general discussions on using our drivers to write your own software here

PT104 PT100 Protocol

Postby dle » Mon Feb 05, 2007 8:19 pm

I am trying to write serial port software for use with the PT100 protocol and there are a number of unclear instructions in the manual that I need help clearing up.

First, in the EEPROM request the manual states the following:
Byte Size
1 Checksum (byte-wise sum of all the bytes from 3 to 34, + 0xDEAD
3 Calibration version (1 = current)
4 Spare
5 Calibration date (ddmmyy followed by NULL char)
13 Batch number
19 Calibration for channel 1 (resistance * 1E6)

23 Calibration for channel 2
27 Calibration for channel 3
31 Calibration for channel 4

When I do a checksum of bytes 3-34, it does not match BYTE 1 nor does it match BYTE 1 and BYTE 2. Is BYTE 2 not used? Or is it part of the Checksum? How is the 0xDEAD value used? Should I assume that the Calibration values use 4 bytes? And also, my PT100 is returning 35 bytes of data, not 34. What is the last byte used for?

Second, for the Conversion Response, the manual states:
Byte Value
1 bits 0-1: measurement no (0 to 3)
bits 2-3: channel no (0 to 3)
bits 4-7: always zero
2-5 reading data: byte 2 is msb

0x20000000 = 0
0xE0000000 = max

My PT100 returns a response where bits 4-7 of BYTE 1 are definitely not zero. Why does that happen? And, what are those 0 and MAX values used for?

Finally, what data types are all these values stored as? I've been assuming that they are all LONG, since the C++ driver uses long to return data.
dle
User
User
 
Posts: 4
Joined: Wed Jan 10, 2007 6:50 pm

Postby ziko » Fri Feb 09, 2007 4:28 pm

Hi and thank you for your post. One of our software engineers has had a look at this and there are a few errors in the protocol section of the help file. He has entered it as a bug report to get the fixed. A copy of the revised protocol is attached.

Here is what he had to say:

"1) The checksum bytes will always 0x55ab.

2) The first of the five byte measurement bytes should be treated as follows:

Measurement no = buffer[0] & 0x03;
Channel no = (buffer[0] >> 2) & 0x03;
buffer[0] >> 4 == 0. This is always the case, I cannot repeat your problem with the non zero bytes.

3) The 0 and the max values are the scaled min and max values. Eg if you are using the 2V5 range, a value of 0x20000000 would be 0V and a value of 0xE000000 would be 2V5. You should never get a value out of this range.

NOTE: The examples in the protocol section of the help file do not take the minimum value into account. Please see the revised protocol examples.

To get a 2V5 measurement you will need to do the following:

value =(((long) buffer [1] << 24) + ((long) buffer [2] << 16) + ((long) buffer [3] << 8) + (long) buffer [4]);
result = (value - 0x20000000L ) * 2500000) / 0x10000000;


4) A longwould be suitable to store the value as it is 4bytes. A short (2 bytes) or a char (1 byte) would not be big enough to store all of the data.
"

Hope this helps.
Attachments
pt104 protocol.txt
(3.37 KiB) Downloaded 175 times
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Postby dle » Wed Feb 28, 2007 10:03 pm

I am still having trouble getting an accurate resistance reading from my PT104. I am reading the following values from the PT104:

Channel Calibration: 2645882117.0
Measurement 1: 536762239.0
Measurement 2: 591613331.0
Measurement 3: 592001185.0
Measurement 4: 651850059.0

Using the equation given in the manual, I get the following:

resistance_x1e6 = 2886925491.3300071
resistance ~= 2886

These values are obviously not correct. I know the probe is working correctly because I can get an accurate reading from Pico Recorder. And I'm somewhat sure I am reading the bytes off the serial port correctly since the bytes read over serial fit the protocol format.

Is there something in the calculation of the resistance that I am missing? For example, the manual mentions the Min Value and Max Value constants but does not use then in resistance calculations for some reason, despite using them in the volt calculations.

Could someone post some known good values for Channel Calibration and Measurement so I can compare them to what I've been getting on my PT104?
dle
User
User
 
Posts: 4
Joined: Wed Jan 10, 2007 6:50 pm

Postby ziko » Tue Mar 13, 2007 10:57 am

Hi and thank you for your post.

You are reading your bytes in the wrong order!

Hope this helps.
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Postby markB » Wed May 02, 2007 2:46 pm

To correct Ziko, you were reading your calibration bytes in the wrong order, your measurements were correct. Here are your correct values:

Channel Calibration: 99988637
Measurement 1: 536762239
Measurement 2: 591613331
Measurement 3: 592001185
Measurement 4: 651850059

Result 109.0991468
Regards

Mark
markB
Site Admin
Site Admin
 
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

new protocol

Postby dlaurent2009 » Tue Feb 03, 2009 1:06 pm

Hello, I'm creating a bench which control temperature and I want to write serial port software for use with the PT100 protocol. unfortunately it is not possible to access to the attachment document "protocol.txt".

Is-it possible to have the protocol which the corrections.

Thank you
Laurent
dlaurent2009
User
User
 
Posts: 2
Joined: Mon Feb 02, 2009 3:40 pm

Postby markB » Tue Feb 03, 2009 2:20 pm

Requests

The computer can send the following request to the PT-104


Command Data bytes Function
0x00 - Get Version
0x01 - Read EEPROM
0x02 one byte, bit 0 is LSB Start Converting
bit 0: enable channel 1 0 = off, 1 = on
bit 1: enable channel 2 ditto
bit 2: enable channel 3 ditto
bit 3: enable channel 4 ditto
bit 4: channel 1 gain 0 = x1, 1 = x21
bit 5: channel 2 gain ditto
bit 6: channel 3 gain ditto
bit 7: channel 4 gain ditto
0x03 bit 0: select 50/60 Hz mains 0 = 50Hz, 1 = 60Hz
Responses

At start-up, and on receipt of a version request, the PT-104 sends a version response.


Byte Value
1 xFF
2 xAA
3 x55
4 x68 Product type
5 x10 Version
On receipt of a Start Converting request, the PT-104 starts sending conversion responses - approx one every 180 milliseconds. There are four measurement points for each channel: the PT-104 automatically cycles through each of the measurements for each of the active channels. Each response is as follows:


Byte Value
1 bits 0-1: measurement no. (0 to 3)
bits 2-3: channel no. (0 to 3)
bits 4-7: always zero
2-5 reading data: byte 2 is MSB

0x20000000 = scaled min
0xE0000000 = scaled max, the result will always be in the range 0x20000000 to 0xE0000000 inclusive.


On receipt of a Read EEPROM request, the unit returns 64 bytes of EEPROM data. This data contains the following:


Byte Size
1 Checksum (always 0x55AB)
3 Calibration version (1 = current)
4 Spare
5 Calibration date (ddmmyy followed by NULL char)
13 Batch number
19 Calibration for channel 1 (resistance * 1E6)
23 Calibration for channel 2
27 Calibration for channel 3
31 Calibration for channel 4
Examples


GAIN = 21
MAXINPUT = 2500000
FSD = 0x10000000
SCALED_MIN = 0x20000000

To obtain a single ended voltage reading 0 - 115 mV

0x0A in byte 1 is measurement no 2 on channel 2.

Reading data in bytes 2-5 giving a value of 0x50000000

Then


result = ((0x50000000 - SCALED_MIN ) * MAXINPUT) / (GAIN * FSD)

= 357142.857142857142857142857142857

where 2500000 is the maximum input voltage in microvolts

where GAIN is a fixed gain factor.

0x10000000 is FSD for a 28-bit ADC

To convert the result to mV divide by 10 000.0

= 35.7142

To obtain a single ended voltage reading 0 - 2.5 V

using the same reading.

0x0A in byte 1 is measurement no 2 on channel 2.

Reading data in bytes 2-5 giving a value of 0x50000000

To convert to voltage:


result = (0x50000000 - SCALED_MIN ) * MAXINPUT) / FSD

where MAXINPUT is the maximum input voltage in microvolts.

To convert result to V divide result by 10 000 000.0

To obtain a differential reading. 0 - 2.5V

Take two measurements on a channel i.e measurement 3 and 2 on channel 2.

then


((measurement 3 - measurement 2) * MAXINPUT) / FSD

To convert result to V divide answer by 10 000 000.0

To calculate a resistance

Read the EEPROM to obtain the calibration information for the channels

Take measurement 0, 1, 2 and 3 on a channel.

Then


result = (channel calibration * (measurement 3 - measurement 2)) / (measurement 1 - measurement 0)

To convert to a resistance divide result by 1 000 000.0

To calculate a temperature

Carry out resistance measurement

Use a lookup table to convert the resistance to a temperature

Copyright 2007 Pico Technology
Regards

Mark
markB
Site Admin
Site Admin
 
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

serial software

Postby Guest » Wed Feb 04, 2009 10:08 am

Hello,

thank you for the protocol. I have a problem sending commands. It seems it works but I have no reply from PT104.

Do you have an example of sending commands and typical reply in C?

Thank you.
Laurent
Guest
 

Postby markB » Wed Feb 04, 2009 10:31 am

I'm afraid we have no examples for the protocol. Do you really need to drive the device directly? There is a C example for the PT104 using the windows DLL. This API is much more simple to use.
Regards

Mark
markB
Site Admin
Site Admin
 
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

pb with dll

Postby Guest » Wed Feb 04, 2009 10:45 am

I'm using the windows dll and copy paste the example from the demo. the function pt104_getvalue doesn't give any value or all the time the same (ex 22FF00) that's why I would like to rs232 protocol.

Laurent
Guest
 

[Resolu]

Postby dlaurent2009 » Tue Feb 10, 2009 4:51 pm

Bonjour,

un collègue m'a dépanné. Tout marche que ce soit sous windows ou sous Linux.

Laurent
dlaurent2009
User
User
 
Posts: 2
Joined: Mon Feb 02, 2009 3:40 pm


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests