松原市网站建设,麻涌仿做网站,wordpress 后台首页,万户oa系统学号#xff1a;140201133 姓名#xff1a;李宇昕 组别#xff1a;第3组 实验地点#xff1a;D19 一、实验目的#xff1a; 1.熟悉WWW技术中的SSI#xff08;Server Side Include#xff09;技术。 2.学会使用SSI技术编写代码把当前开发板内…学号140201133 姓名李宇昕 组别第3组 实验地点D19 一、实验目的 1.熟悉WWW技术中的SSIServer Side Include技术。 2.学会使用SSI技术编写代码把当前开发板内RTC的时钟及日期数据送往PC机浏览器显示。 3.学会使用SSI技术把当前开发板的按键KEY2、KEY1次数信息送往PC机浏览器显示。 二、实验内容 1.编写代码完成Web服务器端发送RTC实时时 钟信息的任务。 2.编写代码完成Web服务器端发送按键KEY2、KEY1按键次数的任务。 三、实验过程描述及结果展示 SSI技术简介 服务器端嵌入SSI(Server Side Include)是一种基于服务器的网页制作技术。大多数的WEB服务器等均支持SSI命令。将内容发送到浏览器之前可以使用“SSI”指令将文本、图形或应用程序信息包含到网页中。因为包含SSI指令的文件要求特殊处理所以必须为所有SSI文件赋予SSI文件扩展名。默认的扩展名是.stm、.shtm、.shtml。 SSI是为WEB服务器提供的一套命令这些命令只要直接嵌入到HTML文档的注释内容之中即可。如!--#include file “info.htm”--就是一条SSI指令其作用是将“info.htm”的内容拷贝到当前页面中。 !-- --是HTML语法中的注释当WEB服务器不支持SSI时会忽略这些信息。 按键与STM32的硬件连接图 STM32F407芯片与键盘的连接电路图如下所示 代码展示 #include sys.h #include string.h #include delay.h #include httpd.h #include lwip/tcp.h #include fs.h #include lwip_comm.h void system_init(void); void RTCTime_Handler(char *pcInsert); void RTCDate_Handler(char *pcInsert); void RTCKey1_Handler(char *pcInsert); void RTCKey2_Handler(char *pcInsert); const char *ppcTAGs[] { time, date, key2, key1 }; u8 key10,key20; void EXTI2_IRQHandler(void){ delay_ms(10); key1; printf(%d\n,key1); EXTI_ClearITPendingBit(EXTI_Line2); } void EXTI3_IRQHandler(void){ delay_ms(10); key2; printf(%d\n,key2); EXTI_ClearITPendingBit(EXTI_Line3); } void EXTIX_Init(void) { NVIC_InitTypeDef NVIC_InitStructure; EXTI_InitTypeDef EXTI_InitStructure; KEY_Init(); //按键对应的I/O初始化 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);//使能SYSCFG时钟 SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE, EXTI_PinSource2);//PE2 连接到中断线2 SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE, EXTI_PinSource3);//PE3 连接到中断线3 /*配置EXTI_Line2,3,4 */ EXTI_InitStructure.EXTI_Line EXTI_Line2 | EXTI_Line3 /*| EXTI_Line4*/; EXTI_InitStructure.EXTI_Mode EXTI_Mode_Interrupt;//中断事件 EXTI_InitStructure.EXTI_Trigger EXTI_Trigger_Falling; //下降沿触发 EXTI_InitStructure.EXTI_LineCmd ENABLE;//中断线使能 EXTI_Init(EXTI_InitStructure);//配置 NVIC_InitStructure.NVIC_IRQChannel EXTI2_IRQn;//外部中断2 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority 0x03;//抢占优先级3 NVIC_InitStructure.NVIC_IRQChannelSubPriority 0x02;//子优先级2 NVIC_InitStructure.NVIC_IRQChannelCmd ENABLE;//使能外部中断通道 NVIC_Init(NVIC_InitStructure);//配置 NVIC_InitStructure.NVIC_IRQChannel EXTI3_IRQn;//外部中断3 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority 0x02;//抢占优先级2 NVIC_InitStructure.NVIC_IRQChannelSubPriority 0x02;//子优先级 2 NVIC_InitStructure.NVIC_IRQChannelCmd ENABLE; //使能外部中断通道 NVIC_Init(NVIC_InitStructure);//配置 } int main(void) { system_init();//系统化初始化 //以下代码对RTC进行初始化 { RTC_InitTypeDef RTC_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE);//使能电源接口时钟 PWR_BackupAccessCmd(ENABLE);//使能RTCSRAM区域 RCC_LSEConfig(RCC_LSE_ON);//开启LSE时钟 RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //选择LSE时钟作为RTC时钟 while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) RESET); //等待LSE准备好 RCC_RTCCLKCmd(ENABLE);//使能RTC时钟 while(RTC_Wait_Synchro());//等待RTC和APB同步 RTC_InitStructure.RTC_HourFormat RTC_HourFormat_24;//24小时格式 RTC_InitStructure.RTC_SynchPrediv 0xFF;//同步预分频器 RTC_InitStructure.RTC_AsynchPrediv 0x7F;//异步预分频器 RTC_Set_Time(10,0,0,0);//设置时间 RTC_Set_Date(17,3,20,1);//设置日期 } EXTIX_Init(); //uart_init(115200); //串口初始化 while(1) { lwip_periodic_handle();//LWIP轮询任务 } } //SSI的Handler u16_t SSIHandler(int iIndex,char *pcInsert,int iInsertLen) { switch(iIndex)//iIndex索引号 { case 0: RTCTime_Handler(pcInsert); break; case 1: RTCDate_Handler(pcInsert); break; case 2: RTCKey2_Handler(pcInsert); break; case 3: RTCKey1_Handler(pcInsert); break; } return strlen(pcInsert); } //SSIHandler中需要用到的处理RTC时间的函数 void RTCTime_Handler(char *pcInsert) { u8 hour,min,sec,ampm; RTC_Get_Time(hour,min,sec,m); *(pcInsert0) (char)((hour/10)0x30); *(pcInsert1) (char)((hour%10)0x30); *(pcInsert2) :; *(pcInsert3) (char)((min/10)0x30); *(pcInsert4) (char)((min%10)0x30); *(pcInsert5) :; *(pcInsert6) (char)((sec/10)0x30); *(pcInsert7) (char)((sec%10)0x30); } void RTCDate_Handler(char *pcInsert) { u8 year,month,day,week; RTC_Get_Date(year,month,day,week); *(pcInsert0) 2; *(pcInsert1) 0; *(pcInsert2) (char)((year/10)0x30); *(pcInsert3) (char)((year%10)0x30); *(pcInsert4) -; *(pcInsert5) (char)((month/10)0x30); *(pcInsert6) (char)((month%10)0x30); *(pcInsert7) -; *(pcInsert8) (char)((day/10)0x30); *(pcInsert9) (char)((day%10)0x30); *(pcInsert10) ; *(pcInsert11) w; *(pcInsert12) e; *(pcInsert13) e; *(pcInsert14) k; *(pcInsert15) :;; *(pcInsert16) (char)(week0x30); } void RTCKey1_Handler(char *pcInsert) { if (key110) { *(pcInsert0) (char)(key10x30); *(pcInsert1) \0; } else { *(pcInsert0) (char)((key1/10)0x30); *(pcInsert1) (char)((key1%10)0x30); *(pcInsert2) \0; } } void RTCKey2_Handler(char *pcInsert) { if (key210) { *(pcInsert0) (char)(key20x30); *(pcInsert1) \0; } else { *(pcInsert0) (char)((key2/10)0x30); *(pcInsert1) (char)((key2%10)0x30); *(pcInsert2) \0; } } 实验心得 这次实验课主要是熟悉WWW技术中的SSIServer Side Include技术。学会使用SSI技术编写代码把当前开发板内RTC的时钟及日期数据送往PC机浏览器显示。学会使用SSI技术把当前开发板的按键KEY2、KEY1次数信息送往PC机浏览器显示。经过老师的指导和同学的帮助。让我对整个过程有了一定的了解和自己的认识但是这次课上的实验我认为还是有一点难度的经过和同组人员的讨论以及老师的指点。我们攻克了难题有自己代码的问题对机器使用的不熟练。重点还是自信心不足。最好也参考了其他的组。总之这次课受益匪浅。明白了这个课之后应该怎么学习可以提高自己的效率。今后的课程会继续努力。转载于:https://www.cnblogs.com/lyxdbk/p/6623835.html