L
Lauwe
- Jan 1, 1970
- 0
I got a ds1722(http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2766) and i
want to interface it to my pc so i can read temperatures. i used the scheme
found at http://www.reed-electronics.com/ednmag/contents/images/245653f1.pdf
no matter what register-byte i write (like 80h, supposed to be write-only)
the chip seems to return the default configuration register (1110 0011)
(even when i set the configuration-register different and try to read it).
to me this indicates there is somesort of problem with the way i try to
write data since it seems to fail every time (sending 0000 0000) wich is the
address that will retrieve the configuration-register for me.
i use the following visual-basic code to retrieve MSB:
*******************************************
Debug.Print "reading temp"
'read first byte at 02h
'set CE high d6 high and d0 high
DlPortWritePortUshort 888, 65
Sleep 100
'first write address 02h (00000010)
'write 6 zeros
For i = 1 To 6
'raise clk leave SDI low
DlPortWritePortUshort 888, 67
Sleep 100
'lower clk (SDI remains low)
DlPortWritePortUshort 888, 65
Sleep 100
Next i
'write 1 one
'raise clk and SDI high
DlPortWritePortUshort 888, 71
Sleep 100
'lower clk (and SDI)
DlPortWritePortUshort 888, 65
Sleep 100
'write 1 zero
'raise clk leave SDI low
DlPortWritePortUshort 888, 67
Sleep 100
'lower clk (SDI remains low)
DlPortWritePortUshort 888, 65
Sleep 100
'now we are ready to read 1 byte
For i = 1 To 8
'raise clk
DlPortWritePortUshort 888, 67
Sleep 100
'read bit
Debug.Print DlPortReadPortUchar(889)
Sleep 10
'lower clk
DlPortWritePortUshort 888, 65
Sleep 100
Next i
'Transfer complete: lower CE
DlPortWritePortUshort 888, 1
Sleep 300
*******************************************
if someone could explain to me what i am doing wrong it would be greatlu
appreciated.
tnx,
Laurens
want to interface it to my pc so i can read temperatures. i used the scheme
found at http://www.reed-electronics.com/ednmag/contents/images/245653f1.pdf
no matter what register-byte i write (like 80h, supposed to be write-only)
the chip seems to return the default configuration register (1110 0011)
(even when i set the configuration-register different and try to read it).
to me this indicates there is somesort of problem with the way i try to
write data since it seems to fail every time (sending 0000 0000) wich is the
address that will retrieve the configuration-register for me.
i use the following visual-basic code to retrieve MSB:
*******************************************
Debug.Print "reading temp"
'read first byte at 02h
'set CE high d6 high and d0 high
DlPortWritePortUshort 888, 65
Sleep 100
'first write address 02h (00000010)
'write 6 zeros
For i = 1 To 6
'raise clk leave SDI low
DlPortWritePortUshort 888, 67
Sleep 100
'lower clk (SDI remains low)
DlPortWritePortUshort 888, 65
Sleep 100
Next i
'write 1 one
'raise clk and SDI high
DlPortWritePortUshort 888, 71
Sleep 100
'lower clk (and SDI)
DlPortWritePortUshort 888, 65
Sleep 100
'write 1 zero
'raise clk leave SDI low
DlPortWritePortUshort 888, 67
Sleep 100
'lower clk (SDI remains low)
DlPortWritePortUshort 888, 65
Sleep 100
'now we are ready to read 1 byte
For i = 1 To 8
'raise clk
DlPortWritePortUshort 888, 67
Sleep 100
'read bit
Debug.Print DlPortReadPortUchar(889)
Sleep 10
'lower clk
DlPortWritePortUshort 888, 65
Sleep 100
Next i
'Transfer complete: lower CE
DlPortWritePortUshort 888, 1
Sleep 300
*******************************************
if someone could explain to me what i am doing wrong it would be greatlu
appreciated.
tnx,
Laurens