SIM900+STM32+MP3+3.2寸LCD原理图SCH
2 E币
成为会员,免费下载资料
文件大小:37.92 KB
上传者:unsung
时间:2013-11-25 21:01:14
下载量:11
[code]下面是我打电话的程序
#include "gprs.h"
#include "LCD_Drive.h"
#include "usart.h"
#include "Touch.h"
extern void Delay_Ms(uint16_t time);
extern void Delay_Us(uint16_t time);
extern void Refreshes_Screen(void);
void gprs_delay(void)
{
unsigned int x,y;
for(x = 0;x<100;x++)
for(y = 500; y>0;y--);
}
void GPRS_init(void)
{
unsigned char buf[256];
printf("AT\r\n");
GSM_getstr(buf);
gprs_delay();
printf("ATE0\r\n");
GSM_getstr(buf);
gprs_delay();
printf("AT+CGMI\r\n"); //厂家信
GSM_getstr(buf);
gprs_delay();
printf("AT+CGMM\r\n"); //获得模块标识
GSM_getstr(buf);
gprs_delay();
printf("AT+CGMR\r\n"); //获得改订的软件版
GSM_getstr(buf);
gprs_delay();
printf("AT+CGSN\r\n");//获得GSM模块的IMEI(国际移动设备标识)序列号
GSM_getstr(buf);
gprs_delay();
printf("AT+CIMI\r\n");//获得IMSI
GSM_getstr(buf);
Disp_LCDString((240-sizeof("GPRS_INIT->OK")*8)/2,0,"GPRS_INIT->OK");
if(buf[0] == 'O')
gprs_delay();
}
unsigned char GPRS_GETNUM(void)
{
unsigned char buf[256],num = 0;
printf("拨号开始!!!");//获得IMSI
while(1)
{
if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下
{
Pen_Int_Set(0); //关闭中断
do
{
Convert_Pos();
Pen_Point.Key_Sta=Key_Up;
if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=53)&&(Pen_Point.Y0<=91))
{
buf[num] = '1';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=53)&&(Pen_Point.Y0<=91))
{
buf[num] = '2';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=53)&&(Pen_Point.Y0<=91))
{
buf[num] = '3';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=140))
{
buf[num] = '4';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=140))
{
buf[num] = '5';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=140))
{
buf[num] = '6';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=151)&&(Pen_Point.Y0<=188))
{
buf[num] = '7';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=188))
{
buf[num] = '8';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=188))
{
buf[num] = '9';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=201)&&(Pen_Point.Y0<=239))
{
buf[num] = '*';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=201)&&(Pen_Point.Y0<=239))
{
buf[num] = '0';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=201)&&(Pen_Point.Y0<=239))
{
buf[num] = '#';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=249)&&(Pen_Point.Y0<=287))
{
printf("ATH\r\n");
num = 0;
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(6*8))/2,25,"nocall");
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=249)&&(Pen_Point.Y0<=287))
{
printf("ATD%s;\r\n",buf);
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(4*8))/2,25,"call");
buf[0]='\0';
num = 0;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=249)&&(Pen_Point.Y0<=287))
{
num--;
buf[num]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
}
Delay_Ms(400);
GPIOC->ODR|=1<<5; //PC5 上拉
}while(PEN==0);//如果PEN一直有效,则一直执行
Pen_Int_Set(1);//开启中断
}
else Delay_Ms(1);
// if(Key==USER)//USER按下,则执行校准程序
// {
// Clear_LCD(BlackColor);//清屏
// Touch_Adjust(); //屏幕校准
// Save_Adjdata();
// Refreshes_Screen();
// }
}
}
[/code]
做了一套基于stm32的类似手机的小耍耍,大家如果感兴趣可以看看,本来想弄个ucos上跑个系统但是一直没有空去弄如果感兴趣可以玩玩;
给大家上点图
[attach]1273[/attach]
[attach]1274[/attach]
原帖[url]http://www.amobbs.com/forum.php?mod=viewthread&tid=5471741&extra=page%3D1%26filter%3Ddigest%26digest%3D1[/url]
#include "gprs.h"
#include "LCD_Drive.h"
#include "usart.h"
#include "Touch.h"
extern void Delay_Ms(uint16_t time);
extern void Delay_Us(uint16_t time);
extern void Refreshes_Screen(void);
void gprs_delay(void)
{
unsigned int x,y;
for(x = 0;x<100;x++)
for(y = 500; y>0;y--);
}
void GPRS_init(void)
{
unsigned char buf[256];
printf("AT\r\n");
GSM_getstr(buf);
gprs_delay();
printf("ATE0\r\n");
GSM_getstr(buf);
gprs_delay();
printf("AT+CGMI\r\n"); //厂家信
GSM_getstr(buf);
gprs_delay();
printf("AT+CGMM\r\n"); //获得模块标识
GSM_getstr(buf);
gprs_delay();
printf("AT+CGMR\r\n"); //获得改订的软件版
GSM_getstr(buf);
gprs_delay();
printf("AT+CGSN\r\n");//获得GSM模块的IMEI(国际移动设备标识)序列号
GSM_getstr(buf);
gprs_delay();
printf("AT+CIMI\r\n");//获得IMSI
GSM_getstr(buf);
Disp_LCDString((240-sizeof("GPRS_INIT->OK")*8)/2,0,"GPRS_INIT->OK");
if(buf[0] == 'O')
gprs_delay();
}
unsigned char GPRS_GETNUM(void)
{
unsigned char buf[256],num = 0;
printf("拨号开始!!!");//获得IMSI
while(1)
{
if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下
{
Pen_Int_Set(0); //关闭中断
do
{
Convert_Pos();
Pen_Point.Key_Sta=Key_Up;
if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=53)&&(Pen_Point.Y0<=91))
{
buf[num] = '1';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=53)&&(Pen_Point.Y0<=91))
{
buf[num] = '2';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=53)&&(Pen_Point.Y0<=91))
{
buf[num] = '3';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=140))
{
buf[num] = '4';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=140))
{
buf[num] = '5';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=140))
{
buf[num] = '6';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=151)&&(Pen_Point.Y0<=188))
{
buf[num] = '7';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=188))
{
buf[num] = '8';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=102)&&(Pen_Point.Y0<=188))
{
buf[num] = '9';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=201)&&(Pen_Point.Y0<=239))
{
buf[num] = '*';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=201)&&(Pen_Point.Y0<=239))
{
buf[num] = '0';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=201)&&(Pen_Point.Y0<=239))
{
buf[num] = '#';
buf[num + 1]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
num++;
}
else if((Pen_Point.X0>=11) && (Pen_Point.X0 <= 73) && (Pen_Point.Y0>=249)&&(Pen_Point.Y0<=287))
{
printf("ATH\r\n");
num = 0;
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(6*8))/2,25,"nocall");
}
else if((Pen_Point.X0>=89) && (Pen_Point.X0 <= 154) && (Pen_Point.Y0>=249)&&(Pen_Point.Y0<=287))
{
printf("ATD%s;\r\n",buf);
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(4*8))/2,25,"call");
buf[0]='\0';
num = 0;
}
else if((Pen_Point.X0>=170) && (Pen_Point.X0 <= 231) && (Pen_Point.Y0>=249)&&(Pen_Point.Y0<=287))
{
num--;
buf[num]='\0';
Disp_LCDString((240-(num*8))/2,25," ");
Disp_LCDString((240-(num*8))/2,25,buf);
}
Delay_Ms(400);
GPIOC->ODR|=1<<5; //PC5 上拉
}while(PEN==0);//如果PEN一直有效,则一直执行
Pen_Int_Set(1);//开启中断
}
else Delay_Ms(1);
// if(Key==USER)//USER按下,则执行校准程序
// {
// Clear_LCD(BlackColor);//清屏
// Touch_Adjust(); //屏幕校准
// Save_Adjdata();
// Refreshes_Screen();
// }
}
}
[/code]
做了一套基于stm32的类似手机的小耍耍,大家如果感兴趣可以看看,本来想弄个ucos上跑个系统但是一直没有空去弄如果感兴趣可以玩玩;
给大家上点图
[attach]1273[/attach]
[attach]1274[/attach]
原帖[url]http://www.amobbs.com/forum.php?mod=viewthread&tid=5471741&extra=page%3D1%26filter%3Ddigest%26digest%3D1[/url]
展开》
折叠》