久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4281|回復(fù): 2
打印 上一主題 下一主題
收起左側(cè)

MM32F103 USB應(yīng)用實例Custom_HID通訊例程

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:714588 發(fā)表于 2020-7-30 16:39 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
基于MM32F103 USB Custom_HID 通訊例程,基于32位 ARM Cortex M3 的MM32F103xBx8的例程

單片機源程序如下:
  1. /* Includes ------------------------------------------------------------------*/
  2. #include "MM32F103.h"
  3. #include "usb_lib.h"
  4. #include "hw_config.h"
  5. #include "usbio.h"
  6. #include "usb_regs.h"


  7. #include "usb_pwr.h"
  8. #include "usb_desc.h"
  9. #include "sys.h"
  10. #include "uart.h"
  11. #include "delay.h"
  12. #include "led.h"


  13. /* Private typedef -----------------------------------------------------------*/
  14. /* Private define ------------------------------------------------------------*/
  15. /* Private macro -------------------------------------------------------------*/
  16. /* Private variables ---------------------------------------------------------*/
  17. /* Extern variables ----------------------------------------------------------*/
  18. /* Private function prototypes -----------------------------------------------*/
  19. void Delay(__IO uint32_t nCount);

  20. extern uint8_t Flag_Receive;


  21. /* Private functions ---------------------------------------------------------*/

  22. /*******************************************************************************
  23. * Function Name  : main.
  24. * Description    : main routine.
  25. * Input          : None.
  26. * Output         : None.
  27. * Return         : None.
  28. *******************************************************************************/

  29. uint8_t table_data[64]={
  30.         
  31.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  32.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  33.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  34.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,        
  35.         
  36. };


  37. int main(void)
  38. {
  39.         
  40.         delay_init();
  41.         
  42.         uart_initwBaudRate(115200);
  43.         
  44.         LED_Init();
  45.         
  46.   Set_System();

  47.   USB_Interrupts_Config();

  48.   Set_USBClock();

  49.   USB_Init();
  50.         
  51.         printf("System Initial Success\r\n");
  52.         
  53.   while (1)
  54.   {
  55.         if(bDeviceState == CONFIGURED)  //等待USB初始化完成
  56.                                 {
  57. //                                        if(Flag_Receive)
  58. //                                        {
  59. //                                                                                         
  60. //                                                        USB_Send_Buffer[0] = 0xaa;
  61. //                                                        USB_Send_Buffer[1] = 0x55;
  62. //                                                        USB_Send_Buffer[2] = 0xaa;
  63. //                                                        USB_Send_Buffer[3] = 0x55;
  64. //                                                        USB_Send_Buffer[4] = 0xaa;
  65. //                                                        USB_Send_Buffer[5] = 0x55;
  66. //                                                        USB_SendData(USB_Send_Buffer,64);         
  67. //                                                
  68. //                                                        Flag_Receive = 0;        
  69. //                                                
  70. //                                        }                                       
  71.                                         USB_SendData(table_data,5);
  72.                                         delay_ms(5000);
  73.                                 }
  74.         //USB_SendData(table_data,64);
  75.                
  76.   }
  77.         
  78. }

  79. /*******************************************************************************
  80. * Function Name  : Delay
  81. * Description    : Inserts a delay time.
  82. * Input          : nCount: specifies the delay time length.
  83. * Output         : None
  84. * Return         : None
  85. *******************************************************************************/
  86. void Delay(__IO uint32_t nCount)
  87. {
  88.   for(; nCount!= 0;nCount--);
  89. }

  90. #ifdef  USE_FULL_ASSERT
  91. /*******************************************************************************
  92. * Function Name  : assert_failed
  93. * Description    : Reports the name of the source file and the source line number
  94. *                  where the assert_param error has occurred.
  95. * Input          : - file: pointer to the source file name
  96. *                  - line: assert_param error line source number
  97. * Output         : None
  98. * Return         : None
  99. *******************************************************************************/
  100. void assert_failed(uint8_t* file, uint32_t line)
  101. {
  102.   /* User can add his own implementation to report the file name and line number,
  103.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  104.   /* Infinite loop */
  105.   while(1)
  106.   {
  107.   }
  108. }
  109. #endif

  110. /******************* (C) COPYRIGHT 2009 Mindmotion *****END OF FILE****/
復(fù)制代碼

所有資料51hei提供下載:
MM32F103_USB_Custom_HID.7z (161.23 KB, 下載次數(shù): 43)
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏2 分享淘帖 頂1 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:584195 發(fā)表于 2021-8-5 22:40 | 只看該作者
樓主,好像用這個的人很少呀?你是做宣傳的嗎?
回復(fù)

使用道具 舉報

板凳
ID:825413 發(fā)表于 2022-3-31 09:18 | 只看該作者
這個程序,我在WIN10上可用正常使用,在win7  和 XP上USB不能識別,是什么問題?
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 91.xxx.高清在线 | 精品一区二区三区免费视频 | 成人av一区二区亚洲精 | 一区二区三区欧美 | 久久国产精品无码网站 | 日日操夜夜操天天操 | 成人av网站在线观看 | 国产一级片在线观看视频 | 久久免费国产 | 美女视频黄的免费 | 在线中文字幕亚洲 | 国产成人精品一区二区三区视频 | 91电影在线| 日韩插插 | 欧美人妖网站 | 国产亚洲高清视频 | 久久一区精品 | 日本成人在线免费视频 | 欧美午夜精品久久久久久浪潮 | 欧美性乱| 中国大陆高清aⅴ毛片 | 成人字幕网zmw | 国产中文在线观看 | 99精品国产一区二区青青牛奶 | 精品毛片在线观看 | 蜜桃视频一区二区三区 | 欧美专区在线 | 天天草天天射 | 欧美一区二区三区在线看 | 久久久高清 | 亚洲中字在线 | 综合精品久久久 | 亚洲精品91 | 亚洲协和影视 | 午夜影院在线观看视频 | a级大片 | 精品欧美色视频网站在线观看 | 黄色一级毛片免费看 | 亚洲精品久久久久久国产精华液 | 日本激情一区二区 | 国产在线视频在线观看 |