📄 tempsen.c
字号:
//====================================================================
//
// Author : ADI - Apps
//
// Date : November 2001
//
// File : TempUart.c
//
// Hardware : ADuC845
//
// Description : This Program takes a temperature measurement
// from the on-chip temp sensor and sends the
// temp in degrees Celcius up the UART to the PC where
// it can be read using hyperterminal
//====================================================================
#include <stdio.h>
#include <ADuC845.h>
void main (void)
{
int i, temp;
//UART config
T3CON = 0x83;
T3FD = 0x12;
SCON = 0x52;
ADCMODE = 0x10; // ENABLE AUX Mode - Power down, Chop ON
ADC1CON = 0x0E; // USE Internal REFERENCE PTAT(+) --> PTAT(-) BIPOLAR MODE Fixed +/- 2.5V range
printf("___________\nAnalog Devices MicroConverter ADuC845\nInternal Temp Sensor Demo Routine____________\n");
while(1)
{
RDY1 = 0;
ADCMODE = 0x12;
while (! RDY1){}; // wait for result
temp = ADC1H-128;
printf("\n\n");
printf("%d degrees C\n", temp);
for (i = 0; i < (10000); i++) {}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -