From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

temperature measurement with DS1722 using NI 8451

Hi,

 

I am trying to read temperature from a MAXIM DS1722 temperature IC using the NI 8451 SPI device. I am having not luck at getting this to work.

 

My experimental VI (Labview 2009) is attached along with a schematic of how the DS1722 is wired (I can't change it, its built into a uut). I have also attached the datasheet for the DS1722.

 

Any suggestions on how I can get this to work will be greatly appreciated.

 

Thanks

 

Ken M

Smiley Happy

 

 

Download All
0 Kudos
Message 1 of 8
(1,644 Views)

Hi,

 

I have attached the schematic of the temperature sensing circuit for the message I posted yesterday. Sorry I forgot to include it.

 

Does anyone have any experience NI 8451 and DS1722 temperature chips?

 

Thanks

 

Ken M

Smiley Happy

0 Kudos
Message 2 of 8
(1,626 Views)

ken_m1,

It looks like your problem lies in your wiring.  I've listed all the things that you need to change:

1. Connect "CE" from your chip to the "CS0" line on the NI 8451.  The chip is a slave device and should only be enabled when the master is ready to recieve data from it.

 

2. The SDO on the chip should be wired to SDI on the NI 8451 (Pin 14).  Basically you have the transmit and recieve lines backwards.  SDO for the chip stands for Serial Data Out, and it looks like you have it wired to terminal 15, which corresponds to the SPI MISO. (Its the Master Input Slave Output pin).

 

3. The SDI on the chip should be wired to SDO on the NI 8451 (Pin 15).  Same reason as #2.

 

Make the changes and see if that helps.  I have not looked at your code yet since the wiring was wrong.  Let me know if this helps!

 

Resources:

http://digital.ni.com/manuals.nsf/websearch/C0872333F7A8C0D686257A290068498D

 

 

-Nathan

Product Support Engineer
National Instruments
0 Kudos
Message 3 of 8
(1,620 Views)

Hi Nathan,

 

I have tried swapping the SDI and SDO lines.

 

I now have the device wired as you suggested.

 

The CE line is tied high internally in my uut and is not accessable through the interface connector.

 

Assuming I have it wired correctly, I am not sure what command to send to read back the temperature.

 

Thanks for responding.

 

I am very appreciative of your help. Smiley Happy

 

Ken M

Smiley Happy

 

 

0 Kudos
Message 4 of 8
(1,613 Views)

Ok, I'm not sure how that will affect the chip's operation.  Normally CE is set high just before communicating with it.  I'm not sure of the specifics of implementing the communication since I don't have the chip.

 

The command to send it is discussed on page 5-8 of the chip's pdf that you posted.   On page 8, figure 5 shows exactly how the SPI communication will happen physically.  You will write a configuration byte, and then the output will start.

 

To do the communication in LabVIEW, I would reccomend starting from the General SPI Read.vi example, which is found in the NI Example Finder (File » Find Examples) under "Hardware Input and Output » I2C and SPI » SPI Basic".  

 

In the example, Chip Select won't affect your application since your not using them.  Make sure the clock rate is set slower than the chip can handle (p.12).  The first byte written to the SPI read/write VI will need to follow the format of the configuration byte in the chip documentation for your desired mode of operation.  The number of bytes read must be the same as the number of bytes written, which is why the example appends 0 bytes to the write when the SPI Read Write vi is called.

 

If you have any further questions about the LabVIEW example, please let me know.

Product Support Engineer
National Instruments
0 Kudos
Message 5 of 8
(1,607 Views)

Hi Nathan,

 

Thanks for your help.

 

I have made some progress with this chip. I fixed my wiring error as you recommended. I also found out that the CS line is not tied high as my schematic shows. There was an error in the unit schematic. Now I am getting some data out but the numbers aren't what I expected and the DS1722 echos back the configuration word that I write to it.

 

Thanks for your help.

 

Ken M

Smiley Happy

0 Kudos
Message 6 of 8
(1,583 Views)

Well, at this point our hardware is communicating with your sensor, the rest of your project sounds like just making sure that your following the protocol defined by the sensor's documentation. Since I don't have the sensor I can only give ideas of what might be wrong.

 

Check to make sure that your writing to the write address for the control register. You may just be telling the device to just read the control register, or maybe the echo is how it is designed to work.

 

Also, make sure that you have the CS line connected to the NI 8451. From looking at the sensor's manual, it looks like it uses the CE line to determine the state of the sensor, like whether it should be sending data back or not.

 

 

I hope this helps.

Product Support Engineer
National Instruments
0 Kudos
Message 7 of 8
(1,567 Views)

@Nathan-P wrote:
2. The SDO on the chip should be wired to SDI on the NI 8451 (Pin 14).  Basically you have the transmit and recieve lines backwards.  SDO for the chip stands for Serial Data Out, and it looks like you have it wired to terminal 15, which corresponds to the SPI MISO. (Its the Master Input Slave Output pin).

 

3. The SDI on the chip should be wired to SDO on the NI 8451 (Pin 15).  Same reason as #2.



Actually, this is incorrect. MISO is a line that specifically is Master In, Slave Out. This should be connected to the SDO line of your slave. Likewise, the MOSI line is Master Out, Slave In, which needs to be connected to the SDI line of your slave.

0 Kudos
Message 8 of 8
(1,538 Views)