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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? 溫度ltc1392 with pic16c84.txt

?? 包括很多單片機(jī)開(kāi)發(fā)用的元代碼
?? TXT
字號(hào):

  Use of an LTC1392 10-bit Temperature, Vcc and Differential Voltage Monitor - Basic Stamp 2 and PIC16C84
歌林電子制作實(shí)驗(yàn)室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

 

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91影视在线播放| 在线不卡中文字幕播放| 午夜一区二区三区视频| 久久蜜臀精品av| 欧美日韩一级黄| 99精品偷自拍| 91精品一区二区三区在线观看| 久久精品一区二区| 欧美精品一卡两卡| 99精品1区2区| 韩国女主播成人在线观看| 亚洲综合色成人| 亚洲欧洲日韩在线| 国产午夜精品久久久久久久| 欧美日韩aaaaa| 91在线视频网址| 国产suv精品一区二区6| 美女视频免费一区| 天天色天天操综合| 亚洲一区在线观看网站| 中文字幕制服丝袜成人av| 精品免费视频一区二区| 在线电影一区二区三区| 欧美亚洲一区三区| 97se狠狠狠综合亚洲狠狠| 国产成人精品网址| 国产精一区二区三区| 蜜桃av噜噜一区| 免费在线观看一区| 日日噜噜夜夜狠狠视频欧美人| 亚洲免费av高清| 亚洲丝袜制服诱惑| 中文字幕一区在线观看视频| 国产色婷婷亚洲99精品小说| 欧美大胆人体bbbb| 日韩欧美区一区二| 精品乱人伦一区二区三区| 欧美一级高清大全免费观看| 欧美日韩成人高清| 欧美日韩国产电影| 欧美高清视频不卡网| 欧美日韩在线免费视频| 欧美色倩网站大全免费| 欧美日韩一级黄| 777xxx欧美| 日韩欧美在线网站| 精品国产乱码久久久久久牛牛| 欧美不卡一区二区三区| 2020国产精品久久精品美国| 精品精品欲导航| 久久久青草青青国产亚洲免观| 欧美精品一区二区三区一线天视频| 日韩精品一区国产麻豆| 精品av久久707| 国产喷白浆一区二区三区| 国产精品福利在线播放| 亚洲欧美经典视频| 天堂成人国产精品一区| 美女mm1313爽爽久久久蜜臀| 久久99久久久久久久久久久| 久久成人免费电影| 高清av一区二区| 91丨porny丨在线| 欧美亚洲一区二区在线| 91精品国产免费| 久久久亚洲国产美女国产盗摄 | 成人av在线资源| 91视频一区二区三区| 欧美色综合网站| 精品久久五月天| 日韩理论片中文av| 日韩高清在线不卡| 国产成人99久久亚洲综合精品| 91丨九色丨尤物| 91精品国产一区二区| 国产校园另类小说区| 亚洲精品日韩专区silk| 青椒成人免费视频| 99热这里都是精品| 91精品久久久久久蜜臀| 国产日韩三级在线| 午夜私人影院久久久久| 国产成人午夜高潮毛片| 欧洲av一区二区嗯嗯嗯啊| 在线播放欧美女士性生活| 欧美激情综合五月色丁香小说| 一区二区三区四区蜜桃| 韩国成人精品a∨在线观看| 色综合久久99| 精品国产一二三区| 亚洲成人精品一区二区| 国产白丝精品91爽爽久久| 欧美高清视频一二三区 | 精品剧情在线观看| 亚洲日本青草视频在线怡红院 | 成a人片国产精品| 337p亚洲精品色噜噜狠狠| 国产精品久久毛片a| 日本成人在线一区| 色综合一区二区| 久久婷婷色综合| 五月婷婷综合在线| 91亚洲永久精品| www国产亚洲精品久久麻豆| 一级做a爱片久久| eeuss鲁一区二区三区| 欧美va亚洲va国产综合| 午夜精品视频一区| 91免费观看视频在线| 久久久亚洲国产美女国产盗摄 | 成人黄色在线视频| 制服丝袜在线91| 一区二区三区免费| k8久久久一区二区三区| 欧美电影免费观看完整版| 五月综合激情网| 91国偷自产一区二区开放时间| 国产日韩欧美在线一区| 精品一区二区三区日韩| 777久久久精品| 亚洲大片免费看| 91传媒视频在线播放| 亚洲图片你懂的| 成人一区二区三区在线观看| 久久久久久久久久久99999| 久久成人免费电影| 欧美videossexotv100| 欧美aaaaa成人免费观看视频| 欧美日韩一区二区三区免费看| 亚洲欧美综合色| thepron国产精品| 国产精品国产三级国产三级人妇| 国产一区二区三区免费播放| 欧美电视剧免费全集观看| 日本不卡高清视频| 欧美一区二区三区四区久久| 日本不卡一区二区三区 | 欧美日韩综合不卡| 亚洲高清视频在线| 欧美人妖巨大在线| 偷拍与自拍一区| 91精品国产综合久久久久| 日韩精品国产精品| 日韩三级免费观看| 韩国精品一区二区| 国产欧美精品一区二区色综合| 国产成人av自拍| 国产精品国产自产拍高清av| 91麻豆免费在线观看| 亚洲一区二区三区精品在线| 欧美日韩一区视频| 奇米色777欧美一区二区| 日韩亚洲欧美高清| 国产成人av自拍| 亚洲欧美一区二区三区国产精品| 欧美怡红院视频| 美腿丝袜在线亚洲一区| 国产三级精品三级| 色哟哟一区二区三区| 午夜精品在线视频一区| 欧美一区二区免费视频| 国产精品亚洲综合一区在线观看| 国产精品视频看| 欧美色网站导航| 看电影不卡的网站| 国产精品久久久久久久久免费相片| 91高清在线观看| 久久国产欧美日韩精品| 国产精品久久久久久久久图文区 | 久久久无码精品亚洲日韩按摩| 国产91精品一区二区| 亚洲精品乱码久久久久久| 欧美日韩国产一区二区三区地区| 美女在线视频一区| 中文字幕一区二区三区视频| 欧美视频一区二区三区四区 | 91视频.com| 日本不卡视频在线观看| 国产精品欧美久久久久一区二区 | 久久久久久影视| 91福利精品第一导航| 麻豆成人在线观看| 亚洲男同1069视频| 日韩欧美www| 91黄色小视频| 国产精品99久久久久久有的能看| 亚洲美女淫视频| 久久亚洲精华国产精华液 | 国产乱子伦视频一区二区三区| 中文字幕亚洲一区二区av在线| 5858s免费视频成人| av成人免费在线| 激情小说欧美图片| 亚洲一区二区三区四区在线| 国产午夜精品一区二区三区四区| 欧美日韩综合色| 成人av动漫在线| 国产一区二区主播在线| 日韩精品一二区| 亚洲一区在线观看免费 |