pyserial to read from DS1615 temperature recorder chip

alexandre_irrthum at yahoo.com alexandre_irrthum at yahoo.com
Mon Jul 24 13:03:30 EDT 2006


Hi there,

I am trying to use pyserial to read data from a temperature logger
device (T-logger). T-logger is based on the DS1615 temperature recorder
chip (Dallas Semiconductor). According to the DS1615 docs, writing to
the chip is performed one byte  at a time. To read from the chip, one
must issue the "read page" command (33h), followed by the two-byte
address of the requested page (pages are 32 bytes long). After
receiving this, the DS1615 will send the data in a burst of (up to) 32
bytes. I can send data to the device, e.g. I can make the device's LED
blink with the test command (44h), but I am unable to read from it.
Connection parameters below are according to DS1615 docs.

>> import serial
>> s = serial.Serial(0, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None)
>> s.write("\x33")
>> s.write("\x00")
>> s.write("\x00")
>> s.read()   # "\x00" is returned here. This byte was already in the receive buffer before issueing the write commands.
>> s.read()   # The interpreter is blocked here as there is nothing to read from the serial port.

I'm completely clueless and would really appreciate your comments. If
it helps, I can post a log from a serial port monitor captured when the
provided T-logger program pulls data from the device, as well as a log
when pyserial is used. And finally, this is a snippet of some basic
code found on the web, that is suppose to do what I want (untested by
me):

open "COM1:9600,N,8,1,CS0,DS0,CD0,ME,FE" as 1
print #1, chr$(&H33);chr$(&H00);chr$(&H00)
result$ = input$(34, #1)

Many thanks,

alex




More information about the Python-list mailing list