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

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

?? 溫度ltc1392 with pic16c84.txt

?? mcu眾多的開發實例
?? 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一区二区三区免费野_久草精品视频
一区二区日韩电影| 日韩西西人体444www| 午夜亚洲国产au精品一区二区| 日韩一区二区免费高清| 成人app软件下载大全免费| 一级做a爱片久久| 久久精品视频免费观看| 欧美丰满少妇xxxxx高潮对白| 国产精品一区三区| 日韩国产欧美一区二区三区| 欧美激情艳妇裸体舞| 日韩一级大片在线| 在线看不卡av| a美女胸又www黄视频久久| 美洲天堂一区二卡三卡四卡视频| 国产精品国产三级国产普通话99| 日韩三级免费观看| 欧美日韩一本到| 99精品桃花视频在线观看| 久久aⅴ国产欧美74aaa| 亚洲高清不卡在线| 国产欧美一区二区精品性| 在线综合+亚洲+欧美中文字幕| 色香色香欲天天天影视综合网| 国产成人免费视频| 麻豆国产一区二区| 白白色 亚洲乱淫| 国产伦精品一区二区三区免费 | 国产成人精品1024| 蜜桃av噜噜一区| 午夜视频一区二区三区| 亚洲欧美日韩国产中文在线| 国产精品丝袜一区| 欧美国产视频在线| 欧美国产日韩a欧美在线观看| 久久综合久久综合亚洲| 欧美一级欧美三级| 日韩欧美国产一区在线观看| 91精品国产一区二区三区| 欧美日韩一本到| 在线播放日韩导航| 91精品黄色片免费大全| 欧美日韩一区二区在线视频| 91九色最新地址| 欧美视频一区二区三区| 欧美视频一区在线| 555www色欧美视频| 日韩精品一区国产麻豆| 精品久久五月天| 久久久久久久综合色一本| 国产日韩欧美一区二区三区综合| 精品国精品国产尤物美女| 精品精品欲导航| 国产亚洲一区二区在线观看| 亚洲国产精品二十页| 国产精品理论在线观看| 亚洲视频一区二区免费在线观看| 亚洲天堂精品在线观看| 午夜在线成人av| 麻豆成人免费电影| 国产91精品在线观看| 91麻豆123| 欧美人伦禁忌dvd放荡欲情| 日韩一区二区三区电影 | 日韩精品一级中文字幕精品视频免费观看| 亚洲国产成人av网| 日韩av不卡一区二区| 国产一区 二区 三区一级| 不卡一区在线观看| 欧美日韩免费观看一区二区三区| 欧美一级一区二区| 欧美激情一区二区三区不卡| 一区二区三区在线观看动漫| 三级亚洲高清视频| 国产成人在线看| 在线看国产一区| 精品国产一区二区三区四区四| 久久久久久久久久久久久夜| 亚洲欧美另类小说| 奇米精品一区二区三区四区| 国产剧情一区二区| 色偷偷久久人人79超碰人人澡| 91麻豆精品久久久久蜜臀| 久久综合色之久久综合| 一区二区三区视频在线看| 久久国产人妖系列| 色综合久久综合| www激情久久| 亚洲精品欧美激情| 国产美女主播视频一区| 欧洲视频一区二区| 久久影视一区二区| 香蕉乱码成人久久天堂爱免费| 国产一区二区三区蝌蚪| 欧美无砖专区一中文字| 国产日韩视频一区二区三区| 日韩精品亚洲一区二区三区免费| 国产成人免费在线视频| 欧美日韩精品综合在线| 中文字幕日韩一区| 激情图片小说一区| 亚洲欧洲另类国产综合| 久久精品久久综合| 在线一区二区观看| 国产午夜精品一区二区三区嫩草| 偷拍一区二区三区| 99精品欧美一区二区蜜桃免费| 精品福利在线导航| 日本大胆欧美人术艺术动态| 91网站最新网址| 久久久久久免费毛片精品| 日本麻豆一区二区三区视频| 色综合久久88色综合天天| 国产午夜精品一区二区 | 一本久道久久综合中文字幕 | 日韩一区二区三区免费观看| 亚洲精品视频在线观看网站| 成人午夜碰碰视频| 精品成人一区二区三区四区| 天堂av在线一区| 欧美性猛片aaaaaaa做受| 中文字幕日本乱码精品影院| 国产精品99久久久久久似苏梦涵 | 国产很黄免费观看久久| 欧美成人video| 日本欧美肥老太交大片| 欧美裸体bbwbbwbbw| 亚洲一区二区三区四区中文字幕 | 日韩欧美国产午夜精品| 91免费视频网址| 亚洲国产电影在线观看| 国产毛片精品一区| 久久久www免费人成精品| 国产一区二区三区黄视频 | 欧美精品一区二区三| 久久99最新地址| 精品国产一区二区三区久久影院| 免费在线成人网| 91精品在线麻豆| 蜜臀91精品一区二区三区| 91精品国产品国语在线不卡| 性久久久久久久| 欧美一区二区三区思思人| 日本va欧美va欧美va精品| 91精品国产入口在线| 九九**精品视频免费播放| 精品对白一区国产伦| 国产一区 二区 三区一级| 国产目拍亚洲精品99久久精品| 国产成人av影院| 国产精品女主播av| 99久久婷婷国产综合精品 | 九色|91porny| 久久久精品欧美丰满| 成人性生交大片免费看中文| 国产精品嫩草影院av蜜臀| 99久久久久免费精品国产 | 亚洲午夜视频在线观看| 欧美伦理影视网| 麻豆精品久久久| 国产日韩影视精品| 91亚洲精华国产精华精华液| 一区二区三区欧美日韩| 在线观看亚洲一区| 九九热在线视频观看这里只有精品| 久久这里只有精品首页| av福利精品导航| 亚洲成人激情自拍| 26uuu精品一区二区| 99国产欧美久久久精品| 亚洲成a人片在线不卡一二三区| 欧美成人一区二区三区片免费 | 国产精品久久久久久户外露出 | 久久综合色一综合色88| 91小视频在线| 麻豆91免费看| 中文字幕亚洲综合久久菠萝蜜| 欧美影片第一页| 国内精品不卡在线| 国产精品久久久久久久久搜平片 | 免费一级片91| 亚洲男人天堂av网| 日韩亚洲欧美在线观看| av影院午夜一区| 免费在线看成人av| 亚洲视频在线一区| 久久综合九色综合欧美98| 91免费观看在线| 九九热在线视频观看这里只有精品| 国产精品蜜臀av| 日韩一二在线观看| 色婷婷av一区二区三区软件| 美女看a上一区| 亚洲猫色日本管| 久久亚洲综合色一区二区三区| 91论坛在线播放| 国产91在线观看丝袜| 日本aⅴ亚洲精品中文乱码| 亚洲人成精品久久久久| 精品国产乱码久久久久久图片|