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.
b. Main control part: Hangshun economical "HK32F030MF4P6" is the first to test the waters.
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.
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.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet