欢迎来到天天文库
浏览记录
ID:44482971
大小:148.46 KB
页数:17页
时间:2019-10-22
《操作SIM300发短信打电话的程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、操作SIM300实现短信,语音,gprs功能//STM32开发板包含文件//触摸屏包含文件includeHstm32fl0x.hninclude”LCD.h“#include"SysTickDelay.h1'includeMUART_INTERFACE.hH#includeUtouch.hn#include"gsm.h"#include2、#defineSIZEsizeof(TEXT_Buffer)externunsignedcharglmage_sms2[56640];#defineLED2_ONGPIO_ResetBits(GPIOC,GPIO_Pin_2)#defineLED2_OFFGPIO_SetBits(GPIOC,GPIO_Pin_2)#defineLED1_ONGPIO_ResetBits(GPIOC,GPIO_Pin_l)#defineLED1_OFFGPIO_SetBits(GPIOC,GPIO_Pin_l)#def3、ineLEDO_ONGPIO_ResetBits(GPIOC,GPIO_Pin_0)#defineLEDO_OFFGPIO_SetBits(GPIOC,GPIO_Pin_0)#defineKEY3.0NGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2)==l#defineKEY3_OFFGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2)!=l#defineKEY2_ONGPIO_ReadlnputDataBit(GPIOE,GPIO_Pin_3)4、==l#defineKEY2_OFFGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_3)!=l#defineKEY1_ONGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4)==l#defineKEY1_OFFGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4)!=l//系统中断管理voidNVIC_Configuration(void){NVICJnitTypeDefNVICJnitStructure;〃定义数据结构体NV5、IC_SetVectorTable(NVIC_VectTab_FLASH,0x0);//将川断矢量放到Flash的0地址NVlC_PriorityGroupConfig(NVIC_PriorityGroup_l)^/设置优先级配置的模式,〃使能串口中断,并设置优先级NVICJnitStructure.NVIC」RQChannel=USARTIJRQn;NVICJnitStructure.NVICJRQChannelPreemptionPriority=1;NVIC_InitStructure.NVIC6、_IRQChannelSubPriority=0;NVICJnitStructure.NVICJRQChannelCmd=ENABLE;NVICJnit(&NVIC_InitStructure);〃将结构体丢到配置函数,即写入到对应寄存器中}〃配置系统时钟,使能各外设时钟voidRCC_Configuration(void){Systemlnit();}〃配置所有外设voidInit_All_Periph(void)RCC_Configuration();NVIC_Configuration();GP7、IO_Configuration();//USARTl_Configuration();USART_Configuration(9600);〃接收中断使能USART_RX」nttemptEnable(USED_COM_NUMBER);voidDeHTy(vu32ncount)fordncountllpncoum;)八一voidLoadlDrowlDiaog(void)LCDIQear(WHITE);wBapointicolorhbLUEW萍M咄妄进时曲LCD—shows2.ng(216o「・RES・-8、)w^NSKa冈MP0INT—C0L0RHRED.A5W匡惟讒曲if(POSCXY(p186))wlif(prelkeyHn-a-)Enu-y(5-一e-seif(pl.elkeyHn-d-)(Entry(-d・);2-seif(pre—keyHn-g-)Entry(g)」一e】seif(prelkeynn_j・)EntryG);elseif(prelkeynNm)Enu-y(-m-)-//Y酚咸合采惡山获〃((OCO忆O0)日xvrono丄)J!•(.
2、#defineSIZEsizeof(TEXT_Buffer)externunsignedcharglmage_sms2[56640];#defineLED2_ONGPIO_ResetBits(GPIOC,GPIO_Pin_2)#defineLED2_OFFGPIO_SetBits(GPIOC,GPIO_Pin_2)#defineLED1_ONGPIO_ResetBits(GPIOC,GPIO_Pin_l)#defineLED1_OFFGPIO_SetBits(GPIOC,GPIO_Pin_l)#def
3、ineLEDO_ONGPIO_ResetBits(GPIOC,GPIO_Pin_0)#defineLEDO_OFFGPIO_SetBits(GPIOC,GPIO_Pin_0)#defineKEY3.0NGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2)==l#defineKEY3_OFFGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2)!=l#defineKEY2_ONGPIO_ReadlnputDataBit(GPIOE,GPIO_Pin_3)
4、==l#defineKEY2_OFFGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_3)!=l#defineKEY1_ONGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4)==l#defineKEY1_OFFGPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4)!=l//系统中断管理voidNVIC_Configuration(void){NVICJnitTypeDefNVICJnitStructure;〃定义数据结构体NV
5、IC_SetVectorTable(NVIC_VectTab_FLASH,0x0);//将川断矢量放到Flash的0地址NVlC_PriorityGroupConfig(NVIC_PriorityGroup_l)^/设置优先级配置的模式,〃使能串口中断,并设置优先级NVICJnitStructure.NVIC」RQChannel=USARTIJRQn;NVICJnitStructure.NVICJRQChannelPreemptionPriority=1;NVIC_InitStructure.NVIC
6、_IRQChannelSubPriority=0;NVICJnitStructure.NVICJRQChannelCmd=ENABLE;NVICJnit(&NVIC_InitStructure);〃将结构体丢到配置函数,即写入到对应寄存器中}〃配置系统时钟,使能各外设时钟voidRCC_Configuration(void){Systemlnit();}〃配置所有外设voidInit_All_Periph(void)RCC_Configuration();NVIC_Configuration();GP
7、IO_Configuration();//USARTl_Configuration();USART_Configuration(9600);〃接收中断使能USART_RX」nttemptEnable(USED_COM_NUMBER);voidDeHTy(vu32ncount)fordncountllpncoum;)八一voidLoadlDrowlDiaog(void)LCDIQear(WHITE);wBapointicolorhbLUEW萍M咄妄进时曲LCD—shows2.ng(216o「・RES・-
8、)w^NSKa冈MP0INT—C0L0RHRED.A5W匡惟讒曲if(POSCXY(p186))wlif(prelkeyHn-a-)Enu-y(5-一e-seif(pl.elkeyHn-d-)(Entry(-d・);2-seif(pre—keyHn-g-)Entry(g)」一e】seif(prelkeynn_j・)EntryG);elseif(prelkeynNm)Enu-y(-m-)-//Y酚咸合采惡山获〃((OCO忆O0)日xvrono丄)J!•(.
此文档下载收益归作者所有