资源简介
SIM800L拨打电话官方程序实例,单片机型号:STC12C5A60S2
代码片段和文件信息
#include “STC_NEW_8051.H“
#include “string.h“
#include
#define S2RI 0x01
#define S2TI 0x02
#define uchar unsigned char
#define uint unsigned int
#define len 52
sbit led=P1^0;
sbit Ukey=P1^1;
sbit Skey=P2^3;
sbit m1=P1^4;
sbit m2=P1^5;
sbit m3=P1^6;
sbit m4=P1^7;
sbit n1=P2^0;
sbit n2=P2^1;
sbit n3=P3^2;
sbit n4=P3^3;
sbit n5=P3^4;
sbit n6=P3^5;
sbit n7=P3^6;
sbit n8=P3^7;
sbit K0=P0^0;
sbit K1=P0^1;
sbit K2=P0^2;
sbit K3=P0^3;
sbit K4=P0^4;
sbit K5=P0^5;
sbit K6=P0^6;
sbit K7=P0^7;
sbit K8=P2^7;
sbit K9=P2^6;
sbit KX=P2^5;
sbit KJ=P2^4;
unsigned int i;//全局用 I
uchar thz=0; //通话中标志位
#define y1 1
#define y2 2
#define y3 3
#define y4 4
#define x1 5
#define x2 6
#define x3 7
#define x4 8
#define x5 9
#define x6 10
#define x7 11
#define x8 12 //系统内存的
#define k0 13 //0
#define k1 14 //1
#define k2 15 //2
#define k3 16 //3
#define k4 17 //4
#define k5 18 //5
#define k6 19 //6
#define k7 20 //7
#define k8 21 //8
#define k9 22 //9
#define kx 23 //*
#define kj 24 //#
unsigned char flag1=0;
unsigned char flag2=0;
void printf1 (uchar *p);
void printf2 (uchar *p);
void UART_1SendOneByte(unsigned char c);
void UART_2SendOneByte(unsigned char c);
uchar usart1buf[len]={0};
uchar usart2buf[len]={0};
void delay_ms(unsigned int i) // -0.018084490741us
{
while(i--)
{
unsigned char ab;
for(b=18;b>0;b--)
for(a=152;a>0;a--);
_nop_(); //if Keilrequire use intrins.h
}
}
////////////////////////////////////////////////////
/////////////////GSM模块测试连接函数////////////////
//测试指令:AT //
//软件延时:1000ms //
//返回值:1 连接正常 //
//返回值:0 其他错误 //
////////////////////////////////
评论
共有 条评论