芯片解密单片机+BMP180+LCD1602温度气压高度计源程序
- 芯片解密#include <REG52.H>
- 芯片解密#include <math.h> //Keil library
- 芯片解密#include <stdlib.h> //Keil library
- 芯片解密#include <stdio.h> //Keil library
- 芯片解密#include <INTRINS.H> //Keil library
- #define uchar unsigned char
- #define uint unsigned int
- #define BMP085_SlaveAddress 0xee //定义器件在IIC总线中的从地址
- #define OSS 0// Oversampling Setting (note: code is not set up to use other OSS values)
- #define DataPort P0 //LCD1602数据端口
- sbit LCM_RS=P2^4; //LCD1602命令端口
- sbit LCM_RW=P2^5; //LCD1602命令端口
- sbit LCM_EN=P2^6; //LCD1602命令端口
- sbit SCL=P1^0; //IIC时钟引脚定义
- sbit SDA=P1^1; //IIC数据引脚定义
- int dis_data; //变量
- typedef unsigned char BYTE;
- typedef unsigned short WORD;
- long temperature;//温度值
- long pressure;//压力值
- long height;//相对海拔高度值
- short ac1;
- short ac2;
- short ac3;
- unsigned short ac4;
- unsigned short ac5;
- unsigned short ac6;
- short b1;
- short b2;
- short mb;
- short mc;
- short md;
- void delay(unsigned int k)
- {
- unsigned int i,j;
- for(i=0;i<k;i++)
- {
- for(j=0;j<121;j++)
- {;}}
- }
- /*******************************/
- void WaitForEnable(void)
- {
- DataPort=0xff;
- LCM_RS=0;LCM_RW=1;_nop_();
- LCM_EN=1;_nop_();_nop_();
- while(DataPort&0x80);
- LCM_EN=0;
- }
- /*******************************/
- void WriteCommandLCM(uchar CMD,uchar Attribc)
- {
- if(Attribc)WaitForEnable();
- LCM_RS=0;LCM_RW=0;_nop_();
- DataPort=CMD;_nop_();
- LCM_EN=1;_nop_();_nop_();LCM_EN=0;
- }
- /*******************************/
- void WriteDataLCM(uchar dataW)
- {
- WaitForEnable();
- LCM_RS=1;LCM_RW=0;_nop_();
- DataPort=dataW;_nop_();
- LCM_EN=1;_nop_();_nop_();LCM_EN=0;
- }
- /***********************************/
- void InitLcd()
- {
- WriteCommandLCM(0x38,1);
- WriteCommandLCM(0x08,1);
- WriteCommandLCM(0x01,1);
- WriteCommandLCM(0x06,1);
- WriteCommandLCM(0x0c,1);
- }

芯片解密