main.c

  1. #include "stm32f4_discovery.h"
  2. #include <stdio.h>
  3.  
  4. #define LED1_ON GPIO_SetBits(GPIOD,GPIO_Pin_12)
  5. #define LED1_OFF GPIO_ResetBits(GPIOD,GPIO_Pin_12)
  6.  
  7. #define LED2_ON GPIO_SetBits(GPIOD,GPIO_Pin_13)
  8. #define LED2_OFF GPIO_ResetBits(GPIOD,GPIO_Pin_13)
  9.  
  10. extern uint8_t NbrOfDataToTransfer;
  11. extern uint8_t NbrOfDataToRead;
  12. extern __IO uint8_t TxCounter;
  13. extern __IO uint16_t RxCounter;
  14.  
  15. extern volatile unsigned char MsgAddEnd;
  16. extern volatile unsigned char MsgAdd[5];
  17. extern volatile unsigned char MsgContentEnd;
  18. extern volatile unsigned char MsgContent[240];
  19.  
  20. void NVIC_Config(void);
  21. void GPIO_Configuration(void);
  22. void STM_EVAL_COMInit(void);
  23. void USART_Configuration(int BaudRate);
  24. void LED_Config(void);
  25. void Delay(__IO uint32_t nCount);
  26.  
  27. void SendMSG2GF(void);
  28. void MsgRemindInit(void);
  29. void ReadMSG(void);
  30. void JudgeFromMsg(void);
  31.  
  32. int main(void)
  33. {
  34. /* Configure the system clocks */
  35. NVIC_Config(); /* NVIC Configuration */
  36.  
  37. //GPIO_Configuration(); /* Configure the GPIOs */
  38. STM_EVAL_COMInit();
  39.  
  40. USART_Configuration(115200); /* Configure the USART1 's mode */
  41. /* Enable the EVAL_COM1 Transmit interrupt: this interrupt is generated when the
  42. EVAL_COM1 transmit data register is empty */
  43. LED_Config();
  44.  
  45. //SendMSG2GF();
  46. MsgRemindInit();
  47.  
  48. USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
  49.  
  50. while (1)
  51. {
  52. Delay(0xFFFF);
  53. ReadMSG();
  54. JudgeFromMsg();
  55. }
  56. }
  57. void MsgRemindInit()
  58. {
  59. int i;
  60. /*AT+CNMI=2,1 短信提示*/
  61. unsigned char CMD1[13] = {0x41 ,0x54 ,0x2B ,0x43 ,0x4E ,0x4D ,0x49 ,0x3D ,0x32 ,0x2C ,0x31 ,0x0D ,0x0A};
  62. /*AT+CMGF=1 英文方式发送*/
  63. unsigned char CMD2[11] = {0x41 ,0x54 ,0x2B ,0x43 ,0x4D ,0x47 ,0x46 ,0x3D ,0x31 ,0x0D ,0x0A};
  64.  
  65. for(i = 0; i < 13; ++i)
  66. {
  67. USART_SendData(USART1, CMD1[i]);
  68. Delay(0xFFF);
  69. }
  70. Delay(0xFFFFFF);
  71. for(i = 0; i < 11; ++i)
  72. {
  73. USART_SendData(USART1, CMD2[i]);
  74. Delay(0xFFF);
  75. }
  76. Delay(0xFFFFFF);
  77. }
  78.  
  79. void ReadMSG()
  80. {
  81. int i;
  82.  
  83. unsigned char CMD1[8] = {0x41 , 0x54 , 0x2B , 0x43 , 0x4D , 0x47 , 0x52 , 0x3D};
  84.  
  85. unsigned char CMD2[5] = {0xff, 0xff, 0xff, 0xff, 0xff}; // 改回000
  86.  
  87. unsigned char CMD3[2] = {0x0D, 0x0A};
  88.  
  89. while(MsgAddEnd == 0) Delay(1);
  90.  
  91. for(i = 0; i < 5; ++i)
  92. {
  93. CMD2[i] = MsgAdd[i];
  94. if(MsgAdd[i] == 0xff) break;
  95. }
  96.  
  97. MsgAddEnd = 0;
  98. for(i = 0; i < 5; ++i) MsgAdd[i] = 0xff;
  99.  
  100. /*tx*/
  101.  
  102. for(i = 0; i < 8; ++i)
  103. {
  104. USART_SendData(USART1, CMD1[i]);
  105. Delay(0xFFF);
  106. }
  107.  
  108. for(i = 0; i < 5; ++i)
  109. {
  110. if(CMD2[i] != 0xff)
  111. {
  112. if(CMD2[i] == 0x00) break;
  113. USART_SendData(USART1, CMD2[i]);
  114. Delay(0xFFF);
  115. }
  116. else break;
  117. }
  118.  
  119. for(i = 0; i < 2; ++i)
  120. {
  121. USART_SendData(USART1, CMD3[i]);
  122. Delay(0xFFF);
  123. }
  124. LED1_ON;
  125. /*waiting for msg content*/
  126. while(MsgContentEnd == 0) Delay(1);
  127. Delay(0xff);
  128. LED1_OFF;
  129. MsgContentEnd = 0;
  130. }
  131.  
  132. void JudgeFromMsg()
  133. {
  134. int i = 0;
  135. if(MsgContent[0] == '1')
  136. {
  137. LED1_ON ;
  138. LED2_ON ;
  139. }
  140. if(MsgContent[0] == '0')
  141. {
  142. LED1_OFF;
  143. LED2_OFF;
  144. }
  145. for(i = 0; i < 240; ++i) MsgContent[i] = 0xff;
  146. }
  147. void SendMSG2GF()
  148. {
  149. int i;
  150. // Step1 : AT+CMGF=1
  151. unsigned char CMD1[11] = {0x41 ,0x54 ,0x2B ,0x43 ,0x4D ,0x47 ,0x46 ,0x3D ,0x31 ,0x0D ,0x0A};
  152. // Step2 : AT+CMGS="18362970179"
  153. unsigned char CMD2[23] = {0x41 ,0x54 ,0x2B ,0x43 ,0x4D ,0x47 ,0x53 ,0x3D ,0x22 ,0x31 ,0x35 ,0x30 ,0x30 ,0x35 ,0x31 ,0x38 ,0x33 ,0x32 ,0x37 ,0x34 ,0x22 ,0x0D ,0x0A};
  154. // Step3 : STM32
  155. unsigned char content[5] = {0x53 ,0x54 ,0x4D ,0x33 ,0x32};
  156. // Step4 : 0x1A
  157. unsigned char CMD3 = 0x1A;
  158.  
  159. for(i = 0; i < 11; ++i)
  160. {
  161. USART_SendData(USART1, CMD1[i]);
  162. Delay(0xFFF);
  163. }
  164. Delay(0xFFFFFF);
  165. for(i = 0; i < 23; ++i)
  166. {
  167. USART_SendData(USART1, CMD2[i]);
  168. Delay(0xFFF);
  169. }
  170. Delay(0xFFFFFF);
  171. for(i = 0; i < 5; ++i)
  172. {
  173. USART_SendData(USART1, content[i]);
  174. Delay(0xFFF);
  175. }
  176. Delay(0xFFFFFF);
  177. USART_SendData(USART1, CMD3);
  178. }
  179. void Delay(__IO uint32_t nCount)
  180. {
  181. while(nCount--)
  182. {
  183. }
  184. }
  185.  
  186. /*******************************************************************************
  187. * Function Name : GPIO_Configuration
  188. * Description : Configures the different GPIO ports.
  189. * Input : None
  190. * Output : None
  191. * Return : None
  192. *******************************************************************************/
  193. void GPIO_Configuration(void)
  194. {
  195. GPIO_InitTypeDef GPIO_InitStructure;
  196.  
  197. /* Configure USART1 Tx (PA.09) as alternate function push-pull */
  198. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  199. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  200. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  201. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  202. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  203. GPIO_Init(GPIOA, &GPIO_InitStructure);
  204.  
  205. /* Configure USART1 Rx (PA.10) as input floating */
  206. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  207. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
  208. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  209. GPIO_Init(GPIOA, &GPIO_InitStructure);
  210. }
  211.  
  212. /**
  213. * @brief Configures COM port.
  214. * @param COM: Specifies the COM port to be configured.
  215. * This parameter can be one of following parameters:
  216. * @arg COM1
  217. * @arg COM2
  218. * @param USART_InitStruct: pointer to a USART_InitTypeDef structure that
  219. * contains the configuration information for the specified USART peripheral.
  220. * @retval None
  221. */
  222. void STM_EVAL_COMInit(void)
  223. {
  224. GPIO_InitTypeDef GPIO_InitStructure;
  225.  
  226. /* Enable GPIO clock */
  227. RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
  228. /* Enable UART clock */
  229. RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
  230.  
  231. /* Connect PXx to USARTx_Tx*/
  232. GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_USART1);
  233. /* Connect PXx to USARTx_Rx*/
  234. GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_USART1);
  235.  
  236. /* Configure USART Tx as alternate function */
  237. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  238. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  239. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  240.  
  241. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
  242. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  243. GPIO_Init(GPIOB, &GPIO_InitStructure);
  244.  
  245. /* Configure USART Rx as alternate function */
  246. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  247. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
  248. GPIO_Init(GPIOB, &GPIO_InitStructure);
  249. }
  250.  
  251. /*******************************************************************************
  252. * Function Name : USART_Configuration
  253. * Description : Configures the USART1.
  254. * Input : None
  255. * Output : None
  256. * Return : None
  257. *******************************************************************************/
  258. void USART_Configuration(int BaudRate)
  259. {
  260. USART_InitTypeDef USART_InitStructure;
  261.  
  262. USART_InitStructure.USART_BaudRate = BaudRate;
  263. USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  264. USART_InitStructure.USART_StopBits = USART_StopBits_1;
  265. USART_InitStructure.USART_Parity = USART_Parity_No ;
  266. USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  267. USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  268. USART_Init(USART1, &USART_InitStructure); /* Configure USART1 basic and asynchronous paramters */
  269. USART_Cmd(USART1, ENABLE); /* Enable USART1 */
  270. }
  271.  
  272. void LED_Config(void)
  273. {
  274. GPIO_InitTypeDef GPIO_InitStructure;
  275. RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD , ENABLE);
  276. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 ;
  277. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  278. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  279. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  280. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  281. GPIO_Init(GPIOD, &GPIO_InitStructure);
  282. }
  283.  
  284. void NVIC_Config(void)
  285. {
  286. NVIC_InitTypeDef NVIC_InitStructure;
  287.  
  288. /* Enable the USARTx Interrupt */
  289. NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
  290. NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  291. NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  292. NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  293. NVIC_Init(&NVIC_InitStructure);
  294. }
  295.  
  296. #ifdef USE_FULL_ASSERT
  297.  
  298. /**
  299. * @brief Reports the name of the source file and the source line number
  300. * where the assert_param error has occurred.
  301. * @param file: pointer to the source file name
  302. * @param line: assert_param error line source number
  303. * @retval None
  304. */
  305. void assert_failed(uint8_t* file, uint32_t line)
  306. {
  307. /* User can add his own implementation to report the file name and line number,
  308. ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  309.  
  310. /* Infinite loop */
  311. while (1)
  312. {
  313. }
  314. }
  315. #endif
  316.  
  317. /*******************************************************************************
  318. * Function Name : fputc
  319. * Description : Retargets the C library printf function to the USART.
  320. * Input : None
  321. * Output : None
  322. * Return : None
  323. *******************************************************************************/
  324. int fputc(int ch, FILE *f)
  325. {
  326. /* Place your implementation of fputc here */
  327. /* e.g. write a character to the USART */
  328. USART_SendData(USART1, (u8) ch);
  329.  
  330. /* Loop until the end of transmission */
  331. while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
  332. {
  333. }
  334.  
  335. return ch;
  336. }

中断函数

  1. #include "stm32f4xx_it.h"
  2.  
  3. #define LED1_ON GPIO_SetBits(GPIOD,GPIO_Pin_12)
  4. #define LED1_OFF GPIO_ResetBits(GPIOD,GPIO_Pin_12)
  5.  
  6. #define LED2_ON GPIO_SetBits(GPIOD,GPIO_Pin_13)
  7. #define LED2_OFF GPIO_ResetBits(GPIOD,GPIO_Pin_13)
  8.  
  9. #define USARTx_IRQHANDLER USART1_IRQHandler
  10.  
  11. #define TXBUFFERSIZE (countof(TxBuffer) - 1)
  12. #define RXBUFFERSIZE 0x20
  13.  
  14. #define countof(a) (sizeof(a) / sizeof(*(a)))
  15.  
  16. /* Private variables ---------------------------------------------------------*/
  17. uint8_t TxBuffer[] = "\n\rUSART Hyperterminal Interrupts Example: USART-Hyperterminal\
  18. communication using Interrupt\n\r";
  19. uint8_t RxBuffer[RXBUFFERSIZE];
  20. uint8_t NbrOfDataToTransfer = TXBUFFERSIZE;
  21. uint8_t NbrOfDataToRead = RXBUFFERSIZE;
  22. __IO uint8_t TxCounter = 0;
  23. __IO uint8_t RxData;
  24. __IO uint16_t RxCounter = 0;
  25.  
  26. volatile unsigned char MsgAddBegin = 0;
  27. volatile unsigned char MsgAddEnd = 0;
  28. volatile unsigned char MsgAddSvCur = 0;
  29. volatile unsigned char MsgAdd[5];
  30. volatile unsigned char MsgContentSvCur = 0;
  31. volatile unsigned char MsgContentBegin = 0;
  32. volatile unsigned char MsgContentEnd = 0;
  33. volatile unsigned char MsgContent[240];
  34.  
  35. volatile unsigned char HeadCur = 0;
  36. #define HeadCnt 3
  37. volatile unsigned char Head[HeadCnt + 1] = {0x2B , 0x43 , 0x4D, 0xff}; // +CM
  38. volatile unsigned char AddHeadCur = 0;
  39. #define AddHeadCnt 9
  40. volatile unsigned char AddHead[AddHeadCnt + 1] = {0x54 ,0x49 ,0x3A ,0x20 ,0x22 ,0x53 ,0x4D ,0x22 ,0x2C, 0xff}; //TI: "SM",
  41. volatile unsigned char AddTailCur = 0;
  42. #define AddTailCnt 2
  43. volatile unsigned char AddTail[AddTailCnt] = {0x0D, 0x0A};
  44. volatile unsigned char ContentHeadCur = 0;
  45. #define ContentHeadCnt 2
  46. volatile unsigned char ContentHead[ContentHeadCnt + 1] = {0x47 ,0x52 ,0xff}; //GR: 0x47 ,0x52 ,0x3A ,0x20, 0xff
  47. volatile unsigned char QuotationMarkCnt = 0; // 8
  48.  
  49. /* Private macro -------------------------------------------------------------*/
  50. /* Private variables ---------------------------------------------------------*/
  51. /* Private function prototypes -----------------------------------------------*/
  52. /* Private functions ---------------------------------------------------------*/
  53.  
  54. /******************************************************************************/
  55. /* Cortex-M4 Processor Exceptions Handlers */
  56. /******************************************************************************/
  57.  
  58. /**
  59. * @brief This function handles NMI exception.
  60. * @param None
  61. * @retval None
  62. */
  63. void NMI_Handler(void)
  64. {
  65. }
  66.  
  67. /**
  68. * @brief This function handles Hard Fault exception.
  69. * @param None
  70. * @retval None
  71. */
  72. void HardFault_Handler(void)
  73. {
  74. /* Go to infinite loop when Hard Fault exception occurs */
  75. while (1)
  76. {
  77. }
  78. }
  79.  
  80. /**
  81. * @brief This function handles Memory Manage exception.
  82. * @param None
  83. * @retval None
  84. */
  85. void MemManage_Handler(void)
  86. {
  87. /* Go to infinite loop when Memory Manage exception occurs */
  88. while (1)
  89. {
  90. }
  91. }
  92.  
  93. /**
  94. * @brief This function handles Bus Fault exception.
  95. * @param None
  96. * @retval None
  97. */
  98. void BusFault_Handler(void)
  99. {
  100. /* Go to infinite loop when Bus Fault exception occurs */
  101. while (1)
  102. {
  103. }
  104. }
  105.  
  106. /**
  107. * @brief This function handles Usage Fault exception.
  108. * @param None
  109. * @retval None
  110. */
  111. void UsageFault_Handler(void)
  112. {
  113. /* Go to infinite loop when Usage Fault exception occurs */
  114. while (1)
  115. {
  116. }
  117. }
  118.  
  119. /**
  120. * @brief This function handles SVCall exception.
  121. * @param None
  122. * @retval None
  123. */
  124. void SVC_Handler(void)
  125. {
  126. }
  127.  
  128. /**
  129. * @brief This function handles Debug Monitor exception.
  130. * @param None
  131. * @retval None
  132. */
  133. void DebugMon_Handler(void)
  134. {
  135. }
  136.  
  137. /**
  138. * @brief This function handles PendSVC exception.
  139. * @param None
  140. * @retval None
  141. */
  142. void PendSV_Handler(void)
  143. {
  144. }
  145.  
  146. /**
  147. * @brief This function handles SysTick Handler.
  148. * @param None
  149. * @retval None
  150. */
  151. void SysTick_Handler(void)
  152. {
  153. }
  154.  
  155. /******************************************************************************/
  156. /* STM32F4xx Peripherals Interrupt Handlers */
  157. /******************************************************************************/
  158.  
  159. /**
  160. * @brief This function handles USARTx global interrupt request.
  161. * @param None
  162. * @retval None
  163. */
  164. void USARTx_IRQHANDLER(void)
  165. {
  166. if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
  167. {
  168. RxData = USART_ReceiveData(USART1);
  169. //USART_SendData(USART1, RxData);
  170. if(MsgAddBegin == 1)
  171. {
  172. if(RxData == 0x0D)
  173. {
  174. MsgAddEnd = 1;
  175. MsgAddBegin = 0;
  176. HeadCur = 0;
  177. AddHeadCur = 0;
  178. MsgAddSvCur = 0;
  179. return;
  180. }
  181. MsgAdd[MsgAddSvCur] = RxData;
  182. MsgAddSvCur++;
  183. return;
  184. }
  185. if(MsgContentBegin == 1)
  186. {
  187. if(RxData == 0x0D)
  188. {
  189. MsgContentEnd = 1;
  190. MsgContentBegin = 0;
  191. HeadCur = 0;
  192. ContentHeadCur = 0;
  193. MsgContentSvCur = 0;
  194. QuotationMarkCnt = 0;
  195. return;
  196. }
  197. MsgContent[MsgContentSvCur] = RxData;
  198. MsgContentSvCur++;
  199. return;
  200. }
  201.  
  202. if(RxData == Head[HeadCur]) HeadCur++;
  203. else
  204. {
  205. if(HeadCur == HeadCnt)
  206. {
  207. if(RxData == AddHead[AddHeadCur]) AddHeadCur++;
  208. if(RxData == ContentHead[ContentHeadCur]) ContentHeadCur++;
  209.  
  210. if(ContentHeadCur == ContentHeadCnt)
  211. {
  212. if(RxData == 0x22) QuotationMarkCnt++ ;
  213. if(QuotationMarkCnt == 8)
  214. {
  215. if(RxData == 0x0A)
  216. {
  217. MsgContentBegin = 1;
  218. MsgContentSvCur = 0;
  219. }
  220. }
  221. return;
  222. }
  223. else if(AddHeadCur == AddHeadCnt)
  224. {
  225. MsgAddBegin = 1;
  226. MsgAddSvCur = 0;
  227. return ;
  228. }
  229. }
  230. else HeadCur = 0;
  231. }
  232.  
  233. }
  234. }
  235. /******************************************************************************/
  236. /* STM32F4xx Peripherals Interrupt Handlers */
  237. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  238. /* available peripheral interrupt handler's name please refer to the startup */
  239. /* file (startup_stm32f4xx.s). */
  240. /******************************************************************************/
  241.  
  242. /**
  243. * @brief This function handles PPP interrupt request.
  244. * @param None
  245. * @retval None
  246. */
  247. /*void PPP_IRQHandler(void)
  248. {
  249. }*/
  250.  
  251. /**
  252. * @}
  253. */
  254.  
  255. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

STM32 控制GSM模块收发信息 F407 discovery的更多相关文章

  1. 通过GSM模块发送经纬度求救信息。

    本博客作为实验笔记,仅供学习交流.(转载请注明出处) 本实验通过GSM模块:SIM900a,实现向特定手机发送sos求救信号,并且利用GPS模块:微科VK2828U7G5LF,将经纬度信息同时发送到手 ...

  2. GSM模块_STM32实现GPRS与服务器数据传输经验总结

    硬件环境 MCU:STM32F103RET6 (调试器:J-Link) GSM模块:Ai-Thinker_A6 (安信可)(还需要配一个串口打印工具,当初选这个模块纯粹是因为价格是最便宜的) ---- ...

  3. GSM模块_GPRS数据传输机制和原理

    通信专业术语 BSS--基站子系统,通过无线接口与移动台直接联系,负责在一定区域内和移动台通信.(GSM) BTS--基站收发台,可以看作一复杂的无线调制器,BSS的主要部分,每个分配有若干信道.(G ...

  4. STM32—驱动RFID-RC522模块

    文章目录 一.S50(M1)卡介绍 1.S50(M1)卡基础知识 2.内部信息 3.存取控制 4.数据块的存取控制 5.控制块的存取控 6.工作原理 7.M1与读卡器的通信 二.RC522工程代码详解 ...

  5. 使用python的email、smtplib、poplib模块收发邮件

    使用python的email.smtplib.poplib模块收发邮件 一封电子邮件的旅程是: MUA:Mail User Agent——邮件用户代理.(即类似Outlook的电子邮件软件) MTA: ...

  6. STM32控制永磁同步电机 | FOC电机控制算法概述

    1. FOC基本概念 参考:https://www.sohu.com/a/432103720_120929980 FOC(field-oriented control)为磁场导向控制,又称为矢量控制( ...

  7. STM32 控制步进电机 28BYJ-48

    STM32 控制步进电机 28BYJ-48  http://blog.chinaunix.net/uid-12664992-id-300272.html 步进电机驱动最简化的逻辑: //四相八拍:A- ...

  8. 解决logging模块日志信息重复问题

    解决logging模块日志信息重复问题 问题描述 相信大家都知道python的logging模块记录日志信息的步骤: # coding:utf-8 import logging ### 创建logge ...

  9. STM32开发 -- 4G模块开发详解(转)

    STM32开发 -- 4G模块开发详解(1) STM32开发 -- 4G模块开发详解(2) STM32开发 -- 4G模块开发详解(3) STM32开发 -- 4G模块开发详解(4)

随机推荐

  1. windows环境下模仿Linux环境发起curl请求

    1.到官网下载curl工具包 2.在curl.exe目录中使用(使用方式1) 解压下载后的压缩文件,通过cmd命令进入到curl.exe所在的目录. 由于博主使用的是windows 64位 的系统,因 ...

  2. Python类总结-析构函数和__call__方法

    class Foo: def __init__(self): pass #析构函数 def __del__(self): print('解释器要销毁我了,我要做最后一次呐喊') def __call_ ...

  3. linux 重写rm命令

    重写rm命令 replease rm to trash   必须使用root编辑/etc/bashrc vim /etc/bashrc 在最后面增加如下脚本 saferm () { if [ ! -d ...

  4. HDU 6215 Brute Force Sorting(模拟链表 思维)

    Brute Force Sorting Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Othe ...

  5. Hibernate 组合主键映射

    在开发过程中创建数据库表时,有时候会发现单纯的创建一个主键是不可行的,有时候就需要多个字段联合保持唯一,本文讲述如何创建组合主键的映射. 例如:记录一个班的考试成绩.学生跟科目是多对多的关系,只有一个 ...

  6. WPF常用控件样式( 内含一简单插件式开发示例)

    最近离职,离职前面的一份外派然后又外包的工作,总觉得不妥,之后外派的办个入职手续都一再失约,干脆推了.恰逢清明时节,暴雨纷纷,于是打算先休息休息调整下状态,工作的事情还是谨慎点的好,免得影响心情.话说 ...

  7. 「Codechef April Lunchtime 2015」Palindromeness

    「Codechef April Lunchtime 2015」Palindromeness 解题思路 : 考虑对于回文子串 \(s\) 贡献的定义: \[ value_s = [\ s[1,\lflo ...

  8. MySQL启动项提权

    关于MySQL的启动项提权,听其名知其意.就是将一段 VBS脚本导入到  C:\Documents and Settings\All Users\「开始」菜单\程序\启动 下,如果管理员重启了服务器, ...

  9. 20162327WJH四则运算第二周总结

    学号 20162327 <程序设计与数据结构>四则运算第二次实验报告 1.需求分析 1.本周我们进行了四则运算的后续完善,因为学习的比较欠缺,所以我负责比较简单的部分,就是只包含一个运算符 ...

  10. 哈希表(散列表)—Hash表解决地址冲突 C语言实现

    哈希表(Hash table,也叫散列表),是根据关键码值(Key value)而直接进行访问的数据结构.也就是说,它通过把关键码值映射到表中一个位置来访问记录,以加快查找的速度.具体的介绍网上有很详 ...