通通

[Hangshun Training Camp] A preliminary exploration of Hangshun MCU copy

 
Overview

Foreword:

-I heard that Hangshun and Lichuang are cooperating. Like, like! ! ! In my understanding, ARM chips have always been very good. Compared with 8051, they have always been a unique chip with cost-effective advantages.

-In the current electronics market where supply is changing rapidly, it is urgent to abandon and replace some foreign chips that are in short supply.

-As domestic chip manufacturing technology gradually matures and develops actively, domestic chips are also worth considering. . .

-Shenzhen Hangshun Chip Technology R&D Co. , Ltd. Established in Shanghai in 2006, its main products include large MCU series: 32-bit M3/M0 general-purpose MCU, 8-bit OTP/MTP/EEPROM/FLASH general-purpose MCU; large memory series: SPI NOR FLASH/NAND FLASH/DRAM/EEPROM ; Large power lithium battery management series; DC/DC step-down series; other series and other chips.

-Lichuang Mall is a one-stop self-operated shopping mall for purchasing electronic components   operated by Shenzhen Lichuang E-Commerce Co., Ltd.  [1] . Engaged in the retail and small-batch procurement of electronic components, it is a one-stop component procurement platform with complete varieties, spot sales, and quality assurance. It is really easy to use! Lots of information.

-Chuangxin Workshop Technology (Shenzhen) Co. , Ltd. Programs are delivered online and burned securely in the cloud. Based on the Internet platform, Jiehe cloud storage, cloud burning and network encryption technology, using the e-commerce operation model, transform the traditional offline delivery mode of chip programs into online delivery! Realize the separation of software and hardware in solution delivery, improve delivery efficiency, and protect developers’ intellectual property rights.

 

Figure 1: Overall renderings

Plan ideas:

  1.Hardware design

a. Power supply part: 12V adapter power supply, DC-DC step-down to 5V. In addition, USB dual power supply mode is added.

dTCKSJutohb2Ay5SSoj6LkfRdx93nCWMMq1fQ8va.png

 

 

b. Main control part: Hangshun economical "HK32F030MF4P6" is the first to test the waters.

6AfhFlrOgNRcAqESIO4z5w5d8mRKliF5uI2AbW6a.png

c. Program download and serial communication: use CH330N to convert USB and TTL. A 5P pin socket is reserved for external expansion to facilitate downloading and communication expansion.

 

d. Function part: I simply bought a 0.96'' OLED, a simple EEPROM, and a simple LDO plus RGB.

vkKYRqXJ5SmvOdH9vmkEX2Wos8wJIjSfNQyOKPW4.png

 

 

  2. Software writing (By MDK5 compiler)

a. Function introduction: system solution

-->Initialize the system clock after power-on, bare-metal programming: initialize RGB lights-->initialize OLED-->initialize buttons-->initialize EEPROM.

-->Enter the main loop, turn on OLED and enter the logo-->RGB running indicator light switches colors in 300ms-->Storage the number of read key presses.

-->When the normal operation button is pressed, a count is displayed on the OLED and stored in the EEPROM.

-->Complete

 

b. Logic code: select the key points to focus on.

--accomplish:

1>RGB colorful effect:

void xShowRgb(void): 300_tick_refresh cycle, 'R' 'G' 'B' each defines a storage container with an upper limit of 300, and the color separation wavelength of this value is output cyclically during the cycle.

void xSetRgb(u8 colo,u8 val): Set the value of the selected color container to adjust the color.

2>Button function:

u8 xKeyScan (u8 mode): Simple pull-up detection low-level design. The left button switches the setting color, and there are buttons to increase the color value, see the renderings 4 and 5.

3>OLED display 12864: Simple IO simulation IIC

xOLED_ShowStr(....): Display string. @Parameters: x coordinate, y page number, the string to be displayed "starting point coordinates (x: 0~127, y: 0~7)". TextSize font size.

xOLED_ShowNum(....): Display numbers and variables. @Parameters: x coordinate, y page number, value to be displayed (0-9999). TextSize font size.

void xOLED_DrawBMP(....): Display bitmap. @Parameter: x0 starting point x, y0 starting point y, x1 end point x, y1 end point y, BMP[] bitmap array.

4>EEPROM: HK24C02 (Follow me, see my other project applications for details)

5>Tpad: touch button (follow me, see my other project applications for details)

 

Show results:

 

 

Figure 2: SW download circuit

 

Figure 3: Startup interface

 

      Figure 4: Switching the adjusted color

 

                            Figure 5: Increase the selection color value (*note1)

 

 

Precautions:

        *note1: Recording the reflection of the mobile phone causes the LED1 on the right side of Figure 5 to always record white (it is truly colorful to the naked eye). For the reason of recording, please watch the color of the reflection of the finger change with the numerical value.

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-23 01:23:34

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号