IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 嵌入式 -> 基于三星单片机S3C9454+NTC热敏电阻的温度检测设计 -> 正文阅读

[嵌入式]基于三星单片机S3C9454+NTC热敏电阻的温度检测设计

1、设计原理:
??????? NTC热敏电阻为3990K,当温度25摄氏度时对应的阻值为100K。NTC热敏电阻的特性是随着温度升高阻值降低。当温度变化时阻值跟着变化,电压也就跟着变化。S3F9454通过ADC6将检测到的电压值转化为实际的温度值。本例温度检测范围为0~100摄氏度。如需检测其它温度范围可根据实际情况改变电路图中R1的阻值。
2、电路图如下:


3、程序代码如下:
;**************************************************************************
?? ?.include?? ?"S3C9454.reg"
TEMP_AD_COUNTER EQU???? 0CH
NTC_TEMP??????? EQU???? 0FH
NTC_TEMPH?????? EQU???? 10H
NTC_TEMPL?????? EQU???? 11H
CODE_DIS??????? EQU???? 12H??????? ;温度值寄存器
FTS???????????? EQU???? 1EH
TMER??????????? EQU???? 1FH
LED_TEMP3?????? EQU???? 2EH
LED_TEMP1?????? EQU???? 2FH
LED_TEMP2?????? EQU???? 30H
LEDTR1????????? EQU???? 31H
LEDTR2????????? EQU???? 32H
LEDTR3????????? EQU???? 33H
DISP_NUM??????? EQU???? 34H

TEMP_CHANNEL??? EQU???? 67H??????? ;温度检测通道 ADC6
;****************************************************
?? ??? ?ORG?? ?0000H
?? ??? ?VECTOR?? ?00H,?? ?INT_SUB
;****************************************************
INT_SUB:
?? ??? ?TM?? ?T0CON,?? ??? ?#1H
?? ??? ?JR?? ?NZ,?? ??? ?INT_TIMER0
ENDINT:?? ??? ?IRET
;---------------------------------------------------
INT_TIMER0:?? ??? ??? ??? ??? ??? ?; 125us定时中断
?? ??? ?AND?? ?T0CON,?? ??? ?#11110110B
??????????????? INC?? ?TMER
?? ??? ?CP?? ?TMER,?? ???????? #16
?? ??? ?JR?? ?ULT,?? ??? ?ENDTIMER0
?? ??? ?CLR?? ?TMER
?? ??? ?LD?? ?FTS,?? ???????? #1H???????????? ;2MS
ENDTIMER0:
ENDTINT:
?? ??? ?IRET
;******************************************************
??????????????? ORG ?? ?003CH
?? ??? ?DB?? ?00H
?? ??? ?DB?? ?00H
?? ??? ?DB?? ?0C8H?? ??? ??? ??? ?; ENABLE LVR (3.0V)
?? ??? ?DB?? ?03H?? ??? ??? ??? ?; INTERNAL RC 3.2MHz

;******************************************************

??????????????? ORG???? 0100H
RESET:?? ??? ?
??????????????? DI
??????????????? LD????? SP,???????????? #0C0H??????? ;指针地址
??????????????? LD????? CLKCON,???????? #00011000B
??????????????? LD????? BTCON,????????? #10100011B
??????????????? LD????? SYM,??????????? #0
IO_INI:
??????????????? LD????? P0,???????????? #00H
??????????????? LD????? P1,???????????? #00H
??????????????? LD????? P2,???????????? #00H

??????????????? LD????? P0CONH,???????? #11111110B
??????????????? LD????? P0CONL,???????? #10101010B
??????????????? LD????? P0PND,????????? #00000000B
??????????????? LD????? P1CON,????????? #00001010B
??????????????? LD????? P2CONH,???????? #01001010B
??????????????? LD????? P2CONL,???????? #10101010B
??????????????? LD????? P0,???????????? #00H
??????????????? LD????? P1,???????????? #00H
??????????????? LD????? P2,???????????? #0FFH
??????????????? LD????? P0PND,????????? #0H
??????????????? LD????? T0DATA,???????? #51
??????????????? LD????? T0CON,????????? #10001010B
??????????????? LD????? PWMDATA,??????? #0
??????????????? LD????? PWMCON,???????? #0
??????????????? LD????? ADCON,????????? #00000000B
??????????????? EI
??????????????? LD????? R0,???????????? #0
RAM_CLR:?? ???????????????????????????????????????? ;寄存器清零
?? ??? ?CLR?? ?@R0
?? ??? ?INC?? ?R0
?? ??? ?CP?? ?R0,?? ??? ?#0BFH
?? ??? ?JR?? ?ULE,?? ??? ?RAM_CLR
;*****************************************************
;主程序
;*****************************************************
MAINLOOP:????????????????? ?
??????????????? CALL??? ADC_GET
?? ??? ?TM?? ?FTS,??????????? #1
?? ??? ?JR?? ?Z,?? ??? ?MAINLOOP
?? ??? ?CLR???? FTS
?? ??? ?LD?? ?BTCON,?? ??? ?#02H
??????????????? CALL??? DISPLAY
?? ??? ?JR?? ?MAINLOOP
;*****************************************************
;AD采样
;*****************************************************
ADC_GET:
??????????????? INC???? R8
??????????????? CP????? R8,???????????? #250
??????????????? JP????? ULT,??????????? END_ADC_GET
??????????????? CLR???? R8
??????????????? LD????? ADCON,????????? #TEMP_CHANNEL
ADC_GET_1:
??????????????? TM????? ADCON,????????? #8H
??????????????? JR????? Z,????????????? ADC_GET_1
??????????????? ADD???? NTC_TEMPL,????? ADDATAH
??????????????? ADC???? NTC_TEMPH,????? #0
??????????????? INC???? TEMP_AD_COUNTER
??????????????? CP????? TEMP_AD_COUNTER,#16??????????????????? ;16次采样取平均
??????????????? JR????? ULT,??????????? END_ADC_GET
??????????????? CLR???? TEMP_AD_COUNTER
??????????????? RCF
??????????????? RRC???? NTC_TEMPH
??????????????? RRC???? NTC_TEMPL
??????????????? RCF
??????????????? RRC???? NTC_TEMPH
??????????????? RRC???? NTC_TEMPL
??????????????? RCF
??????????????? RRC???? NTC_TEMPH
??????????????? RRC???? NTC_TEMPL
??????????????? RCF
??????????????? RRC???? NTC_TEMPH
??????????????? RRC???? NTC_TEMPL
??????????????? LD????? NTC_TEMP,?????? NTC_TEMPL
??????????????? CLR???? R2
??????????????? LD????? R3,???????????? NTC_TEMP
??????????????? LDC???? R0,???????????? #TAB_TEMP[RR2]????????? ;温度曲线
??????????????? LD????? CODE_DIS,?????? R0
??????????????? CLR???? NTC_TEMPL
??????????????? CLR???? NTC_TEMPH
END_ADC_GET:
?? ??? ?RET
;*********************************************************
;数据管显示
;*********************************************************
DISPLAY:
??????????????? LD????? LEDTR1,???????? #0FFH
??????????????? LD????? LEDTR2,???????? #0FFH
??????????????? LD????? LEDTR3,???????? #0FFH
??????????????? AND???? P0,???????????? #0F8H
??????????????? OR????? P2,???????????? #0FFH

??????????????? LD????? LED_TEMP3,????? CODE_DIS
??????????????? CALL??? DIV_CODE
DISP_LED:
??????????????? INC???? DISP_NUM
??????????????? CP????? DISP_NUM,?????? #4
??????????????? JR????? ULT,??????????? DISP_STEP
??????????????? LD????? DISP_NUM,?????? #1
DISP_STEP:
??????????????? CP????? DISP_NUM,?????? #1
??????????????? JR????? EQ,???????????? DISP_STEP1
??????????????? CP????? DISP_NUM,?????? #2
??????????????? JR????? EQ,???????????? DISP_STEP2
??????????????? CP????? DISP_NUM,?????? #3
??????????????? JR????? EQ,???????????? DISP_STEP3
??????????????? JP????? DISPLAY_END
DISP_STEP1:
??????????????? OR????? P0,???????????? #1H
??????????????? LD????? P2,???????????? LEDTR3????????????? ;个位
??????????????? JP????? DISPLAY_END
DISP_STEP2:
??????????????? OR????? P0,???????????? #2H
??????????????? LD????? P2,???????????? LEDTR2????????????? ;十位
??????????????? JP????? DISPLAY_END
DISP_STEP3:
??????????????? OR????? P0,???????????? #4H
??????????????? LD????? P2,???????????? LEDTR1????????????? ;百位
??????????????? JR????? DISPLAY_END
DISPLAY_END:
?? ??? ?RET
;--------------------------------------------------------------------
DIV_CODE:
??????????????? CLR???? LED_TEMP1
??????????????? CLR???? LED_TEMP2
CALL_TABLED1:
??????????????? CP????? LED_TEMP3,????? #10
??????????????? JR????? ULT,??????????? CALL_TABLED2
??????????????? SUB???? LED_TEMP3,????? #10
??????????????? INC???? LED_TEMP2
??????????????? JR????? CALL_TABLED1
CALL_TABLED2:
??????????????? CP????? LED_TEMP2,????? #10
??????????????? JR????? ULT,??????????? CALL_TABLED3
??????????????? SUB???? LED_TEMP2,????? #10
??????????????? INC???? LED_TEMP1
??????????????? JR????? CALL_TABLED2
CALL_TABLED3:
??????????????? CP????? LED_TEMP1,????? #0
??????????????? JR????? EQ,???????????? CALL_TABLED4
??????????????? AND????? LEDTR1,???????? #4FH
CALL_TABLED4:
??????????????? CLR???? R2
??????????????? LD????? R3,???????????? LED_TEMP2
??????????????? LDC???? R0,???????????? #TAB_LED[RR2]
??????????????? LD????? LEDTR2,???????? R0
??????????????? CLR???? R2
??????????????? LD????? R3,???????????? LED_TEMP3
??????????????? LDC???? R0,???????????? #TAB_LED[RR2]
??????????????? LD????? LEDTR3,???????? R0
??????????????? RET
;******************************************************
;TABLE
;******************************************************
TAB_LED:?????????????????????? ?
??????? DB????? 01H???? ;0
??????? DB????? 4FH???? ;1
??????? DB????? 12H???? ;2
??????? DB????? 06H???? ;3
??????? DB????? 4CH???? ;4
??????? DB????? 24H???? ;5
??????? DB????? 20H???? ;6
??????? DB????? 0FH???? ;7
??????? DB????? 00H???? ;8
??????? DB????? 04H???? ;9
;**************************************
;温度曲线
;**************************************
;???????????? 温度值??? AD值
TAB_TEMP:???????????? ?
??????? DB????? 00????? ;0
??????? DB????? 00????? ;1
??????? DB????? 00????? ;2
??????? DB????? 00????? ;3
??????? DB????? 00????? ;4
??????? DB????? 00????? ;5
??????? DB????? 00????? ;6
??????? DB????? 00????? ;7
??????? DB????? 00????? ;8
??????? DB????? 00????? ;9
??????? DB????? 00????? ;10
??????? DB????? 00????? ;11
??????? DB????? 00????? ;12
??????? DB????? 00????? ;13
??????? DB????? 01????? ;14
??????? DB????? 02????? ;15
??????? DB????? 03????? ;16
??????? DB????? 04????? ;17
??????? DB????? 05????? ;18
??????? DB????? 06????? ;19
??????? DB????? 07????? ;20
??????? DB????? 08????? ;21
??????? DB????? 09????? ;22
??????? DB????? 10????? ;23
??????? DB????? 11????? ;24
??????? DB????? 12????? ;25
??????? DB????? 13????? ;26
??????? DB????? 13????? ;27
??????? DB????? 14????? ;28
??????? DB????? 15????? ;29
??????? DB????? 16????? ;30
??????? DB????? 16????? ;31
??????? DB????? 17????? ;32
??????? DB????? 17????? ;33
??????? DB????? 18????? ;34
??????? DB????? 19????? ;35
??????? DB????? 20????? ;36
??????? DB????? 21????? ;37
??????? DB????? 21????? ;38
??????? DB????? 22????? ;39
??????? DB????? 22????? ;40
??????? DB????? 23????? ;41
??????? DB????? 24????? ;42
??????? DB????? 24????? ;43
??????? DB????? 25????? ;44
??????? DB????? 26????? ;45
??????? DB????? 26????? ;46
??????? DB????? 27????? ;47
??????? DB????? 27????? ;48
??????? DB????? 28????? ;49
??????? DB????? 29????? ;50
??????? DB????? 29????? ;51
??????? DB????? 30????? ;52
??????? DB????? 30????? ;53
??????? DB????? 31????? ;54
??????? DB????? 31????? ;55
??????? DB????? 31????? ;56
??????? DB????? 32????? ;57
??????? DB????? 32????? ;58
??????? DB????? 33????? ;59
??????? DB????? 33????? ;60
??????? DB????? 34????? ;61
??????? DB????? 35????? ;62
??????? DB????? 35????? ;63
??????? DB????? 36????? ;64
??????? DB????? 36????? ;65
??????? DB????? 37????? ;66
??????? DB????? 37????? ;67
??????? DB????? 38????? ;68
??????? DB????? 38????? ;69
??????? DB????? 38????? ;70
??????? DB????? 39????? ;71
??????? DB????? 39????? ;72
??????? DB????? 40????? ;73
??????? DB????? 40????? ;74
??????? DB????? 41????? ;75
??????? DB????? 41????? ;76
??????? DB????? 42????? ;77
??????? DB????? 42????? ;78
??????? DB????? 42????? ;79
??????? DB????? 43????? ;80
??????? DB????? 43????? ;81
??????? DB????? 44????? ;82
??????? DB????? 44????? ;83
??????? DB????? 45????? ;84
??????? DB????? 45????? ;85
??????? DB????? 46????? ;86
??????? DB????? 46????? ;87
??????? DB????? 47????? ;88
??????? DB????? 47????? ;89
??????? DB????? 48????? ;90
??????? DB????? 48????? ;91
??????? DB????? 48????? ;92
??????? DB????? 49????? ;93
??????? DB????? 49????? ;94
??????? DB????? 50????? ;95
??????? DB????? 50????? ;96
??????? DB????? 51????? ;97
??????? DB????? 51????? ;98
??????? DB????? 51????? ;99
??????? DB????? 52????? ;100
??????? DB????? 52????? ;101
??????? DB????? 53????? ;102
??????? DB????? 53????? ;103
??????? DB????? 53????? ;104
??????? DB????? 54????? ;105
??????? DB????? 54????? ;106
??????? DB????? 55????? ;107
??????? DB????? 55????? ;108
??????? DB????? 56????? ;109
??????? DB????? 56????? ;110
??????? DB????? 57????? ;111
??????? DB????? 57????? ;112
??????? DB????? 58????? ;113
??????? DB????? 58????? ;114
??????? DB????? 58????? ;115
??????? DB????? 59????? ;116
??????? DB????? 59????? ;117
??????? DB????? 59????? ;118
??????? DB????? 60????? ;119
??????? DB????? 60????? ;120
??????? DB????? 61????? ;121
??????? DB????? 61????? ;122
??????? DB????? 62????? ;123
??????? DB????? 62????? ;124
??????? DB????? 63????? ;125
??????? DB????? 63????? ;126
??????? DB????? 64????? ;127
??????? DB????? 64????? ;128
??????? DB????? 65????? ;129
??????? DB????? 65????? ;130
??????? DB????? 65????? ;131
??????? DB????? 66????? ;132
??????? DB????? 66????? ;133
??????? DB????? 67????? ;134
??????? DB????? 67????? ;135
??????? DB????? 68????? ;136
??????? DB????? 68????? ;137
??????? DB????? 69????? ;138
??????? DB????? 69????? ;139
??????? DB????? 69????? ;140
??????? DB????? 70????? ;141
??????? DB????? 70????? ;142
??????? DB????? 71????? ;143
??????? DB????? 71????? ;144
??????? DB????? 72????? ;145
??????? DB????? 72????? ;146
??????? DB????? 73????? ;147
??????? DB????? 73????? ;148
??????? DB????? 74????? ;149
??????? DB????? 74????? ;150
??????? DB????? 75????? ;151
??????? DB????? 75????? ;152
??????? DB????? 75????? ;153
??????? DB????? 76????? ;154
??????? DB????? 76????? ;155
??????? DB????? 77????? ;156
??????? DB????? 78????? ;157
??????? DB????? 78????? ;158
??????? DB????? 79????? ;159
??????? DB????? 79????? ;160
??????? DB????? 80????? ;161
??????? DB????? 80????? ;162
??????? DB????? 81????? ;163
??????? DB????? 81????? ;164
??????? DB????? 82????? ;165
??????? DB????? 83????? ;166
??????? DB????? 83????? ;167
??????? DB????? 83????? ;168
??????? DB????? 84????? ;169
??????? DB????? 84????? ;170
??????? DB????? 85????? ;171
??????? DB????? 85????? ;172
??????? DB????? 86????? ;173
??????? DB????? 87????? ;174
??????? DB????? 87????? ;175
??????? DB????? 88????? ;176
??????? DB????? 89????? ;177
??????? DB????? 89????? ;178
??????? DB????? 90????? ;179
??????? DB????? 90????? ;180
??????? DB????? 91????? ;181
??????? DB????? 91????? ;182
??????? DB????? 92????? ;183
??????? DB????? 92????? ;184
??????? DB????? 93????? ;185
??????? DB????? 93????? ;186
??????? DB????? 94????? ;187
??????? DB????? 95????? ;188
??????? DB????? 96????? ;189
??????? DB????? 97????? ;190
??????? DB????? 98????? ;191
??????? DB????? 98????? ;192
??????? DB????? 99????? ;193
??????? DB????? 100???? ;194
??????? DB????? 100???? ;195
??????? DB????? 100???? ;196
??????? DB????? 100???? ;197

?? ?END

  嵌入式 最新文章
基于高精度单片机开发红外测温仪方案
89C51单片机与DAC0832
基于51单片机宠物自动投料喂食器控制系统仿
《痞子衡嵌入式半月刊》 第 68 期
多思计组实验实验七 简单模型机实验
CSC7720
启明智显分享| ESP32学习笔记参考--PWM(脉冲
STM32初探
STM32 总结
【STM32】CubeMX例程四---定时器中断(附工
上一篇文章      下一篇文章      查看所有文章
加:2021-09-20 15:56:14  更:2021-09-20 15:57:34 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/26 2:53:00-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码