亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 溫度ltc1392 with pic16c84.txt

?? 單片機開發源代碼集錦 31例 需要的話請去下載
?? TXT
字號:

  Use of an LTC1392 10-bit Temperature, Vcc and Differential Voltage Monitor - Basic Stamp 2 and PIC16C84
歌林電子制作實驗室www.nbglin.com 
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 = $00 'temperature measurement in (degrees C). 
gosub make_meas
T_100 = (25 * get_10)-13000 
debug "T_100 = " 
debug dec T_100, CR 'CR is carriage return.

mode = $01 'VCC measurement.
gosub make_meas
VCC_100 = (60 * get_10)/128+242
debug "VCC_100 = "
debug dec VCC_100, CR

mode = $02 'differential voltage measurement, 1V
scale.
gosub make_meas
DIFF_VOL_100_1 = (100 * get_10)/1024
debug "DIFF_VOL_100_1 = "
debug dec DIFF_VOL_100_1, CR

mode = $03 'differential voltage measurement, 
' 0.5V scale.
gosub make_meas
DIFF_VOL_100_2 = (50 * get_10)/1024 
debug "DIFF_VOL_100_2 = "
debug dec DIFF_VOL_100_2, CR

debug CR
pause 4000 ' pause between readings
next
stop

make_meas:
high clk_pin
high cs_pin ' 1392 reset
low cs_pin ' beginning of sequence
gosub send_data_4 ' send 4 bit command
gosub get_data_10 ' fetch 10 bit result
high cs_pin ' disable 1392
return


send_data_4: ' send command nibble beginning with most sig bit
out_4 = $09 | (mode << 1) ' 1 M_1 M_0 1
for n = 3 to 0
if( (out_4 & $08) = 0) then out_0 ' test bit 3
high tx_data ' and output 1 or 0
L2:
gosub clock_pulse ' followed by negative clock
out_4=out_4<<1 ' align next bit in bit 3 pos
next
return 

out_0:
low tx_data
goto L2

'''''''''''

get_data_10: ' read ten bits on rx_data, 
' beginning with most significant bit
get_10 = 0
gosub clock_pulse ' send one clock pulse
for n = 0 to 9
low clk_pin ' bring clock low
get_10 = (get_10<<1) | rx_data ' read bit
high clk_pin ' clock back to high
next
return

clock_pulse:
low clk_pin
high clk_pin
return


PIC16C84 - Program LTC1392.ASM. 

This program illustrates how to interface a PIC with an LTC1392. 

One measurement is made in each mode and the result is saved to a data buffer. Note that each measurement consists of 10-bits and thus, each measurement is saved in the data buffer as two bytes. The DAT_HI variable consists of the hgighest two bits and DAT_LO of the low eight bits. 

In the program, the raw measurement data is then displayed on a serial LCD. However, it is important to note that this data might be saved in a serial EEPROM for later retrieval and downloading to a PC. 

Unlike the program for the Basic Stamp, this program does not include any calculations on the raw data. Another discussion offers that in many instances, calculation is not necessary nor necessarily desireable. But, if it is thoughts are offered on how the calculations may be done with simple byte by byte multiplcation, two byte add and subtracts and BCD conversion routines. These are implemented in other discussions. 

One point of interest is the use of a two byte shift in the RX_DATA_10 routine which fetches the 10-bit result from the LTC1392. 

DAT_HI and DAT_LO are both initialized to zero and the following loop is executed ten times. 

BTFSS PORTB, RX_D
BCF STATUS, C ; set CY to either a 0 or 1
BTFSC PORTB, RX_D
BSF STATUS, C
RLF DAT_L, F ; do a two byte left shift
RLF DAT_H, F

Note that the carry bit is either set to a zero or one, depending on the state of the RX_D input bit. This is then left shifted into DAT_LO. Note that the most significant bit of DAT_LO is now in the carry bit. This is then left shifted into DAT_HI, such that it is now the least significant bit in DAT_HI. 


; LTC1392.ASM
;
; 16C84 LTC1392
;
; PORTB.3 (term 9) <--RX_D------------ D_OUT (term 2)
; PORTB.2 (term 8) ---TX_D-----------> D_IN (term 1)
; PORTB.1 (term 7) ---CLK------------> CLK (term 3)
; PORTB.0 (term 6) ---C_S------------> C_S (term 4)
;
; copyright, Towanda Malone, Morgan State Univ, August 5, '97

LIST p=16c84
#include <c:\mplab\p16c84.inc>
__CONFIG 11h

CONSTANT RX_D = 3 ; bits defined on PortB
CONSTANT TX_D = 2 
CONSTANT CLK = 1
CONSTANT C_S = 0

CONSTANT DATA_BUFF = 18H

CONSTANT BASE_VAR = 0CH

MODE EQU BASE_VAR+0 ; mode = 0, 1, 2, or 3

TEMP EQU BASE_VAR+1 ; scratchpad
NUM EQU BASE_VAR+2 ; index

DELAY_LOOP EQU BASE_VAR+3 ; timing

DAT_H EQU BASE_VAR+4 ; 10-bit quantity fetched from ltc1392
DAT_L EQU BASE_VAR+5

ORG 000H

CLRF PORTB
BSF STATUS, RP0
BSF TRISB, RX_D ; input
BCF TRISB, TX_D ; TX_D, CLK and C_S are outputs
BCF TRISB, CLK
BCF TRISB, C_S
BCF STATUS, RP0

MAIN:
MOVLW DATA_BUFF ; pointer to beginning of data_buff
MOVWF FSR

MOVLW .0
MOVWF MODE

MAIN_1: CALL MAKE_MEAS ; make a measurment

MOVF DAT_H, W ; and save two bytes in data_buff
MOVWF INDF

INCF FSR, F
MOVF DAT_L, W
MOVWF INDF
INCF FSR, F

INCF MODE, F ; go through mode 0. 1, 2, 3
MOVLW .4
SUBWF MODE, W
BTFSS STATUS, Z
GOTO MAIN_1

CALL DISPLAY ; display content of data_buff
MAIN_2: 
GOTO MAIN_2


MAKE_MEAS: ; performs a measurment in specified mode
; result is returned in DAT_HI and DAT_LO
CALL C_SEL_HI 
CALL CLK_HI
CALL C_SEL_LO ; bring /CS low
CALL TX_DATA_4 ; send 4-bit command
CALL RX_DATA_10 ; fetch 10-bit result
CALL C_SEL_HI
RETURN

DISPLAY: ; display content of data_buff on serial LCD
CALL LCD_CLR

MOVLW DATA_BUFF ; initialize pointer to data_buff
MOVWF FSR

MOVLW .4
MOVWF NUM

DISPLAY_1:
MOVF INDF, W ; fetch byte and display on serial LCD
CALL LCD_VAL
INCF FSR, F
MOVF INDF, W
CALL LCD_VAL
INCF FSR, F

MOVLW " " ; separate with a space
CALL LCD_CHAR

DECFSZ NUM, F
GOTO DISPLAY_1
RETURN

TX_DATA_4: ; send 4-bit command to ltc1392
BCF STATUS, C
RLF MODE, W ; 09H | (mode <<1)
IORLW 09H

MOVWF TEMP ; save to scratch pad

MOVLW .4 ; 4 bits
MOVWF NUM

TX_DATA_4_1:
BTFSS TEMP, 3 ; most significant bit first
BCF PORTB, TX_D ; set up TX_D
BTFSC TEMP, 3
BSF PORTB, TX_D

CALL CLK_LO ; and then negative going clock pulse
CALL CLK_HI

RLF TEMP, F ; next bit to bit 3 position

DECFSZ NUM, F
GOTO TX_DATA_4_1
RETURN

RX_DATA_10: ; fetches 10 bit result from ltc1392
CLRF DAT_H
CLRF DAT_L

CALL CLK_LO ; a dummy clock pulse
CALL CLK_HI

MOVLW .10 ; 10 bits
MOVWF NUM
RX_DATA_10_1:
CALL CLK_LO ; bring clock low and read bit
BTFSS PORTB, RX_D
BCF STATUS, C ; set CY to either a 0 or 1
BTFSC PORTB, RX_D
BSF STATUS, C
RLF DAT_L, F ; do a two byte left shift
RLF DAT_H, F
CALL CLK_HI

DECFSZ NUM, F
GOTO RX_DATA_10_1
RETURN

CLK_HI:
BSF PORTB, CLK
CALL DELAY_100USEC
RETURN

CLK_LO:
BCF PORTB, CLK
CALL DELAY_100USEC
RETURN

C_SEL_HI:
BSF PORTB, C_S
CALL DELAY_100USEC
RETURN

C_SEL_LO:
BCF PORTB, C_S
CALL DELAY_100USEC
RETURN

DELAY_100USEC:
MOVLW .20
MOVWF DELAY_LOOP ; 20 * 5 + 2 = 102 cycles
DELAY_100USEC_1:
NOP
NOP
DECFSZ DELAY_LOOP, F
GOTO DELAY_100USEC_1

RETURN

#INCLUDE <A:\LCD\LCD_CTRL.ASM>
END

 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
首页国产欧美久久| 亚洲裸体xxx| 欧美一区在线视频| 欧美怡红院视频| 91网站在线播放| 一本到不卡免费一区二区| www.视频一区| 97se亚洲国产综合自在线| 99综合电影在线视频| av一二三不卡影片| 91麻豆免费视频| 欧美性xxxxxx少妇| 欧美日韩国产综合视频在线观看| 色综合久久中文字幕综合网| av不卡在线播放| 韩国午夜理伦三级不卡影院| 青草av.久久免费一区| 免费av网站大全久久| 香蕉成人伊视频在线观看| 亚洲国产成人av好男人在线观看| 亚洲视频一区在线| 久久久午夜电影| 中文字幕不卡的av| 国产女同互慰高潮91漫画| 国产精品久久久久桃色tv| 国产精品午夜免费| 中文天堂在线一区| 国产精品免费人成网站| 国产精品女同一区二区三区| 中文字幕成人av| 亚洲欧洲av在线| 免费在线视频一区| 免费一级片91| 日韩国产欧美视频| 久久99国产精品免费| 精品无人码麻豆乱码1区2区| 成人美女在线观看| 91丨porny丨蝌蚪视频| 欧美日韩大陆在线| 成人久久18免费网站麻豆| 激情另类小说区图片区视频区| 国产精品国产三级国产专播品爱网 | 不卡欧美aaaaa| 国产在线精品视频| 久久91精品久久久久久秒播| 人人精品人人爱| 免费一级片91| 国产综合一区二区| 粉嫩高潮美女一区二区三区| 国产精品77777| 成人国产精品免费观看| 成人福利电影精品一区二区在线观看| 91麻豆精品视频| 久久99精品国产91久久来源| 国产精品亚洲а∨天堂免在线| 免费成人美女在线观看| 久久伊人中文字幕| 久久蜜桃av一区精品变态类天堂 | 欧美aa在线视频| 青青草伊人久久| 99riav久久精品riav| 欧美日韩国产乱码电影| 国产欧美日韩精品一区| 亚洲国产成人精品视频| 91丨九色丨蝌蚪丨老版| 日韩三区在线观看| 日韩精品一区二区三区中文精品| 国产精品网友自拍| 一区二区不卡在线播放| 日韩成人免费电影| 欧美日韩精品一区二区三区蜜桃| 欧美午夜理伦三级在线观看| 久久免费的精品国产v∧| 亚洲三级在线播放| 精品系列免费在线观看| 欧美日韩国产经典色站一区二区三区| 日本伊人色综合网| 美女任你摸久久| 日韩电影一二三区| 亚洲精品国产精华液| 国产成人aaaa| 91精品国产色综合久久| 亚洲自拍偷拍av| 国产大陆a不卡| 日韩写真欧美这视频| 日韩理论片中文av| 大陆成人av片| 欧美一三区三区四区免费在线看| 中文字幕不卡在线播放| 麻豆精品一区二区三区| 91福利在线看| 国产精品成人午夜| 韩国av一区二区| 欧美高清dvd| 亚洲免费观看高清在线观看| 不卡欧美aaaaa| 精品国产91亚洲一区二区三区婷婷| 一区二区三区四区激情| 欧美吞精做爰啪啪高潮| 久久先锋影音av| 国产一区二区三区四| 91麻豆精品国产自产在线 | 亚洲男人的天堂一区二区 | 国产精品中文有码| 日韩欧美精品三级| 亚洲成人自拍一区| 欧美三级欧美一级| 亚洲男人电影天堂| 99精品视频一区二区三区| 精品国产乱码久久久久久影片| 免费在线观看一区二区三区| 欧洲亚洲精品在线| 亚洲欧美电影院| www.亚洲精品| 国产精品青草综合久久久久99| 国产在线观看免费一区| 日韩色在线观看| 美国欧美日韩国产在线播放| 日韩免费电影网站| 美国精品在线观看| 精品国产髙清在线看国产毛片| 美女视频黄 久久| 精品国内二区三区| 精品一区二区三区免费观看| 自拍偷拍欧美激情| 精品嫩草影院久久| 99久久精品久久久久久清纯| 亚洲午夜日本在线观看| 26uuu国产电影一区二区| 国产精品中文有码| 国产精品久久久久久久久快鸭| 欧洲一区在线电影| 国产一区二区三区久久悠悠色av| **欧美大码日韩| 久久久国产一区二区三区四区小说 | 精品日产卡一卡二卡麻豆| 在线观看日韩电影| 色八戒一区二区三区| 尤物av一区二区| 欧美日韩一卡二卡三卡| 国产黑丝在线一区二区三区| 亚洲综合一区二区三区| 午夜精品久久久久久久久| 91色|porny| 精品国产乱码久久久久久牛牛| 亚洲精品国久久99热| 在线精品亚洲一区二区不卡| 日韩电影一二三区| 久久久99精品久久| 日本在线播放一区二区三区| 日本一区二区三区四区| 色婷婷一区二区| 黑人精品欧美一区二区蜜桃| 国产精品欧美精品| 色噜噜狠狠色综合中国| 欧美剧在线免费观看网站| 91高清在线观看| 欧美在线免费视屏| 欧美性做爰猛烈叫床潮| 欧美一区二区三区人| 欧美色图激情小说| 欧美三级中文字| 欧美人动与zoxxxx乱| 欧美性色黄大片| 欧美肥妇bbw| 婷婷综合五月天| 久久一区二区视频| 午夜日韩在线电影| 欧美日本一区二区| 国产不卡视频在线观看| 亚洲r级在线视频| 亚洲精品一区二区三区福利| 国产乱子伦一区二区三区国色天香 | 久久国产精品一区二区| 亚洲综合色在线| 欧美大肚乱孕交hd孕妇| 一本大道久久a久久综合婷婷 | 国产盗摄女厕一区二区三区 | 久久精品国产成人一区二区三区| 国产精品无圣光一区二区| 欧美成人一级视频| 91丨porny丨户外露出| 美女爽到高潮91| 曰韩精品一区二区| 日韩一区二区三区高清免费看看| 色综合久久综合中文综合网| 韩国成人精品a∨在线观看| 日本午夜精品视频在线观看| 中文在线资源观看网站视频免费不卡 | 91美女片黄在线观看| 国产在线一区二区综合免费视频| 国产精品卡一卡二| xnxx国产精品| 色88888久久久久久影院按摩| 国产99精品国产| 天堂一区二区在线免费观看| 亚洲综合一区二区三区| 国产精品青草综合久久久久99| 久久精品夜夜夜夜久久| 91精品国产手机|