Use ZLG's dynamic link library for dynamic loading.
ARM is Context-M3-1343.
Host computer communication software developed in C++ Builder 6.
The USB communication code is as follows:
//---------------------------------------------------------------------------
#include #pragma hdrstop #include "Unit1.h" //#include "zyUSBDev.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { unsigned char sendbuf[1024],recbuf[1024]; int i; unsigned char Substitution; for (i = 0; i < sizeof(sendbuf); i++) { sendbuf[i] = Inbyte; //Put the hexadecimal byte into the send buffer 4096 bytes recbuf[i] = 0; // Clear the receive buffer } /******************* Let's start using the dynamic library **************************/ int ret; AnsiString m_Disp = " china"; unsigned char cmd[2],ack; cmd[0] = sizeof(sendbuf) / 256; //The high 8 bits of the length of the number of bytes to be sent cmd[1] = sizeof(sendbuf) % 256; // lower 8 bits HINSTANCE handle; FARPROC lpFarProc; int __stdcall (*pFun)(int,unsigned char*,int,int);//change handle = LoadLibrary("zyUSBDev.dll"); lpFarProc = GetProcAddress(handle, "zyUSB_ReadData"); pFun = (int(__stdcall*)(int,unsigned char*,int,int))lpFarProc; //__cdecl //Step 5: Use logical endpoint 2 to receive a large amount of data from the USB device ret = pFun(2, recbuf, sizeof(sendbuf), 1000); if (ret != sizeof(sendbuf)) { if (ret <= 0) { m_Disp = "Logical endpoint 2 receive data error: No valid data was received."; } else if (ret > 0) { m_Disp = "Logical endpoint 2 receive data error: Partial data received."; } // MessageBox("Logical endpoint 2 receiving data error"); return; } // Display the received bytes m_Disp = ""; int temp = 0; temp = recbuf[0] + recbuf[1] * 256; m_Disp= IntToStr(temp) + " "; for (i = 0; i < sizeof(sendbuf); i++) m_Disp = m_Disp + recbuf[i] + " "; Memo1->Text = m_Disp; FreeLibrary(handle); } //---------------------------------------------------------------------------
Previous article:Azure ARM (7) ARM Template - Edit using Visual Studio
Next article:Bootloader program upgrade principle and code analysis based on ARM Cortex-M0+ core
Recommended ReadingLatest update time:2024-11-23 19:26
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- usb_host_device_code
- Multithreaded computing in embedded real-time operating systems - based on ThreadX and ARM
- Single-chip microcomputer C language programming and simulation
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- How to choose the audio amplifier/boost/charging management IC for Bluetooth speakers?
- Working principle of sampling resistor
- Practical information! The most comprehensive Linux application development case sharing, including key codes!
- EEWORLD University ---- Introduction to Machine Learning
- Which expert can give me some scientific knowledge?
- RF PoL: A Special Variety of Point-of-Load Converters
- Virtual sound card frequency meter
- Fast computation of two-way single-number frequency transforms for audio coding1
- Thank you for having you +EEWORLD
- Linear CCD--TCD1304AP output signal error