找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3901|回复: 1
收起左侧

STM32 Labview USB通信源码

[复制链接]
ID:317903 发表于 2018-4-27 21:03 | 显示全部楼层 |阅读模式
labview 的usb通信
0.jpg

单片机源程序如下:
  1. /**
  2.   ******************************************************************************
  3.   * @file    main.c
  4.   * @author  MCD Application Team
  5.   * @version V4.0.0
  6.   * @date    21-January-2013
  7.   * @brief   Virtual Com Port Demo main file
  8.   ******************************************************************************
  9.   * @attention
  10.   *
  11.   * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
  12.   *
  13.   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  14.   * You may not use this file except in compliance with the License.
  15.   * You may obtain a copy of the License at:
  16.   *
  17.   *
  18.   * Unless required by applicable law or agreed to in writing, software
  19.   * distributed under the License is distributed on an "AS IS" BASIS,
  20.   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21.   * See the License for the specific language governing permissions and
  22.   * limitations under the License.
  23.   *
  24.   ******************************************************************************
  25.   */


  26. /* Includes ------------------------------------------------------------------*/
  27. #include "hw_config.h"
  28. #include "usb_lib.h"
  29. #include "usb_desc.h"
  30. #include "usb_pwr.h"
  31. #include <string.h>
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. /* Private typedef -----------------------------------------------------------*/
  35. /* Private define ------------------------------------------------------------*/
  36. /* Private macro -------------------------------------------------------------*/
  37. /* Private variables ---------------------------------------------------------*/
  38. /* Extern variables ----------------------------------------------------------*/
  39. /* Private function prototypes -----------------------------------------------*/
  40. /* Private functions ---------------------------------------------------------*/

  41. /*******************************************************************************
  42. * Function Name  : main.
  43. * Description    : Main routine.
  44. * Input          : None.
  45. * Output         : None.
  46. * Return         : None.
  47. *******************************************************************************/
  48. extern uint32_t USB_SIL_WriteEDP1Dbbuf( uint8_t* pBufferPointer, uint32_t wBufferSize);
  49. u8 t;
  50. char usbsndbuf[64];

  51. void  snddata(void)
  52. {
  53. static        int i=0;
  54. int len;        
  55. i++;

  56. USB_SIL_WriteEDP1Dbbuf(usbsndbuf, 64);
  57.         

  58. }

  59. int main(void)
  60. {
  61.         for(t=0;t<64;t++)
  62.         usbsndbuf[t]=t;
  63.   Set_System();
  64.   Set_USBClock();
  65.   USB_Interrupts_Config();
  66.   USB_Init();
  67.   
  68.   while (1)
  69.   {

  70.                 snddata();
  71.                
  72.   }
  73. }
  74. #ifdef USE_FULL_ASSERT
  75. /*******************************************************************************
  76. * Function Name  : assert_failed
  77. * Description    : Reports the name of the source file and the source line number
  78. *                  where the assert_param error has occurred.
  79. * Input          : - file: pointer to the source file name
  80. *                  - line: assert_param error line source number
  81. * Output         : None
  82. * Return         : None
  83. *******************************************************************************/
  84. void assert_failed(uint8_t* file, uint32_t line)
  85. {
  86.   /* User can add his own implementation to report the file name and line number,
  87.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  88.   /* Infinite loop */
  89.   while (1)
  90.   {}
  91. }
  92. #endif

  93. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
复制代码

所有资料51hei提供下载:
STM32 Labview USB通信.rar (625.47 KB, 下载次数: 80)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

ID:403087 发表于 2018-9-27 12:09 | 显示全部楼层
谢谢分享!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表