專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命
提供開發(fā)工具、應(yīng)用測試 完善的開發(fā)代碼案例庫分享
從全面的產(chǎn)品導(dǎo)入到強大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!
提供新的芯片及解決方案,提升客戶產(chǎn)品競爭力
提供最新的單片機資訊,行業(yè)消息以及公司新聞動態(tài)
單片機方案開發(fā)商深圳英銳恩分享溫度LTC1392 with PIC16C84單片機。
Use of an LTC1392 10-bit Temperature, Vcc and Differential Voltage Monitor - Basic Stamp 2 and PIC16C84
Introduction.
The Linear Technology LTC1392 is an inexpensive 10-bit A/D converter with the added capability of measuring the temperature of the IC and the value of the nominal +5 V supply. This makes it ideal in monitoring the health of the environment in any electronic equipment.
The low power dissipation also makes it an ideal IC for remote data logging using battery power. The quiescent current when idle is typically 0.2 uA. While performing a conversion the current drain rises to nominally 350 uA.
The device is available from DigiKey (LTC1392CN8-ND) for $7.50 in single unit quantities. A data sheet in .pdf format may be obtained from Linear Technologies.
In the following discussion, interfacing a Basic Stamp 2 with a single LTC1392 is illustrated. Interfacing the LTC1392 with a PIC is also discussed.
Sequence.
A measurement sequence is started by bringing /CS low which resets the device. Note that as it is the high to low transition, CS must first be at logic one. After bringing /CS low, a minimum delay of 80 usecs is required for a temperature measurement and 10 usecs for all other measurements.
Four configuration bits are then serially transmitted by the processor using the TX_DATA and CLK leads. In transmitting toward the device, the data is first set up on the on the TX_DATA lead and the CLK is then brought momentarily low. The actual capture of the data by the LTC1392 is on the rising edge of the clock.
Note that when the device is not selected (/CS high) and during the time this four bits is being sent by the processor, the devices D_out lead (RX_DATA) is in a high impedance mode.
Upon sending the four configuration bits, the 1392's D_out lead (RX_DATA) comes out of tri-state and the result is serially shifted toward the processor, beginning with a logic zero and then the most significant bit or a 10-bit result. Each data bit is transmitted by the LTC1392 on the falling edge of the clock.
Upon receipt of the 10 bits, the /CS is brought high, ending the measurement sequence.
Actually, I left a little out. The device may be configured such that after receipt of the 10 bit result in most significant bit format, continued clocking will cause the result to again be output in least significant bit format. I do not deal with this capability in this discussion. Actually, I am uncertain I grasp why anyone would want it.
The Command Bits.
After bringing /CS low, a four bit conguration word is sent to the device. Bit b_3, (the most significant bit) is always a logic one and is termed the "start" bit. Bits b_2 and b_1 determine the measurement mode as shown;
Mode b_2 b_1 Measurment
0 0 0 Temperature
1 0 1 V_cc
2 1 0 V_differential (1.0 V Full Scale)
3 1 1 V_differential (0.5 V Full Scale)
Bit b_0 is used to specify whether the least significant bit first sequence is to follow the most significant bit first sequence and mentioned above. Let's just cut through the confusion and set it to a logic 1.
Thus, the configuration word is;
mode = 0x09 | (mode << 1);
where the mode is either 0, 1, 2 or 3 as noted in the above table.
Conversions.
Upon receiving the 10 bits of data, the temperature, V_cc or other voltage is calculated.
Temperature.
The range between -130 degrees C and 125.75 degrees C is broken into 1024 discrete bands. Thus,
T_c = (125.75 - (-130)) * band / 1024 - 130.0
or T_c = 256/1024 * band - 130
= band / 4.0 - 130.0
For the Stamp;
T_100 = 100 * T_c = 25 * band - 13000
V_cc.
The range between 2.42 and three times 2.42 is broken into 1024 bands. Thus,
V_cc = (3*2.42 - 2.42) * band / 1024 + 2.42
= (2*2.42) * band / 1024 + 2.42
= 4.84 * band / 1024 + 2.42
For the Stamp;
V_CC_100 = 100 * V_cc = (60 * band)/128+242
Other.
When measuring the differential voltage between +V_in and -V_in using the 1.0 full scale reference;
V_diff = band / 1024 * 1.0
For the Stamp;
DIFF_VOL_100_1 = 100 * V_diff = (100 * band)/1024
When using the 0.5 V full scale;
V_diff = band / 1024 * 0.5
For the Stamp;
DIFF_VOL_100_2 = 100 * V_diff = (50 * band)/1024
Basic Stamp 2 - Program LTC1392.BS2.
In program LTC1392.BS2 a Basic Stamp 2 is used to fetch the values of temperature, V_cc and V_diff using both of the references. Note that it is assummed there is an applied voltage of less than 0.5 Volts between +V_in and -V_in.
The four-measurement sequence is repeated ten times.
' LTC1392.BS2
'
' Measures Temperature in degrees C, V_cc, V_diff (1.0 V Ref) and V_diff
' (0.5 V Ref). Ten such measurment sequences performed.
'
' Basic Stamp 2 LTC1392
'
'
' PIN11 (term 15) <----RX_DATA --------- (term 2) D_out
'
' PIN10 (term 14) ---- TX_DATA --------- (term 1) D_in
' PIN9 (term 13) ----- CLK ------------- (term 3) CLK
' PIN8 (term 12) ----- /CS ------------- (term 4) /CS
' ------- (term 6) +V_in
' ------- (term 7) -V_in
'
'
' +5 ---- (term 8) V_cc
' GRD --- (term 5) GRD
'
' copyright, Towanda Malone, Morgan State University, May 22, '97
'
get_10 var word ' 10 bits fetched from LTC1392
out_4 var byte ' 4 bits sent to 1392
m var byte ' index used in main
n var byte ' index used in subroutines
mode var byte ' 0 - Temperature measurment
' 1 - V_CC meas
' 2 - V_diff (1.0 V Reference)
' 3 - V_diff (0.5 V Reference)
T_100 var word ' 100 * T in degrees C
VCC_100 var word ' 100 * V_CC (Volts)
DIFF_VOL_100_1 var word ' 100 * V_diff (1.0 V Reference)
DIFF_VOL_100_2 var word ' 100 * V_diff (0.5 V Reference)
rx_data var in11
tx_data con 10
clk_pin con 9
cs_pin con 8
dirs = $07ff ' 8, 9, 10 Outputs, 11 Input
main:
for m = 1 to 10 ' make ten measurment sequences
mode =