⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aduc848.c

📁 this is the sample code for reading data from aduc 848 adc. this is the c file.
💻 C
字号:


/*****************************/
/* 		 Includes  			 */
/*****************************/
#include <ADuC848.H>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <intrins.h>
#include <math.h>


/******************************/
/* SFR e outras defini珲es    */
/******************************/

#define L1		    0x80	    // Linha 1 do LCD
#define L2		    0xC0	    // Linha 2 do LCD
#define TRUE		0x01		// Value representing TRUE
#define	FALSE		0x00		// Value representing FALSE
#define ON			0x01		// Value representing ON
#define	OFF			0x00		// Value representing OFF
#define HIGH		0x01		// Value representing ON
#define	LOW			0x00		// Value representing OFF

#define READ		0x01		// FlashEE command:  'read page'
#define WRITE		0x02		// FlashEE command:  'write page'
#define VERIFY		0x04		// FlashEE command:  'verify page'
#define ERASE		0x05		// FlashEE command:  'erase page'
#define ERASEALL	0x06		// FlashEE command:  'erase all'

#define PH			0
#define MVx1		1
#define MVx10		2
#define GRAUC		3

sbit COLUNA1 		= P0^3;     // Teclado
sbit COLUNA2 		= P0^2;
sbit COLUNA3 		= P0^1;
sbit COLUNA4 		= P0^0;
sbit LINHA1			= P0^4;
sbit LINHA2			= P0^5;
sbit LINHA3			= P0^6;
sbit LINHA4			= P0^7;

sbit D7				= P2^3;		// 4 Bits para LCD
sbit D6				= P2^2;
sbit D5				= P2^1;
sbit D4				= P2^0;
sbit E				= P2^4;     // E= 1  Select LCD
sbit RS				= P3^7;		// RS=1 (LCD msg)	RS=0 (LCD cmd)
sbit RW				= P3^6;		// R=1, W=0


/*****************************/
/*     Vari醰eis Globais     */
/*****************************/
unsigned char code msg_easy[] = "EASY   (16)9179-7768";
unsigned char code msg_city[] = "Rib.Preto-SP  BRASIL";
unsigned char code msg_branco[] = "                    ";
unsigned char code msg_calib[]= "Calibrando...aguarde";
unsigned char code msg_setup[]= "Setup do sistema !!!";
unsigned char idata lcd_buf[21],  mode,  tecla;

int bits_off_setx1, bits_off_setx10, bits_off_settemp;
float mv_ganhox1, mv_ganhox10, temp_ganho, zero_cal7, gain_cal4_10;

unsigned char ADC0mid;          		// normalized ADC0 conversion result
unsigned char ADC0high;
unsigned char xchr;

bit b_set_relatx1, b_set_relatx10, b_cal7_ok, b_cal4_10_ok, b_out1, b_out2, b_out_temp;
bit newADCdata;          				// 1 means new ADC data available

/*****************************/
/*   Prot髏ipos de Fun珲es   */
/*****************************/
char teclado ( void );													// f

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -