Exploring STC 8051 Microcontrollers – Coding


As with any new microcontroller, I enjoyed developing stuffs for STC micros too. Every hardware peripheral was a new experience for me, especially the PCA module. The reasons why I love exploring 8051 core-based MCUs are their relative ease of usage, compatibility and similarity. STC microcontrollers were no exceptions.

There were times during the forging of this work, I did face some odd issues while cherished at some other points and here in the end I would like share some of them.

  • While trying out multichannel ADCs, I did notice significant interference amongst channels but later I fixed it by changing ADC clock speed.
  • The analogue frontend of STC micros need special attention when designing PCBs because things may not look good if things as stated in the first point happen.
  • The more the resolution of an ADC, the more noise it is likely to pick and so external Op-Amp-based buffering and filtering should be considered. Good external reference voltage source should be used for good accuracy.
  • As with any 8051-based MCU, memory model is a very important stuff and should be considered in some cases, especially when dealing with pointers and large arrays. The following link describes memory model in details specifically for Keil C51 C compiler: https://www.keil.com/support/man/docs/c51/c51_le_memmodels.htm
  • The programmer GUI is a tool that has many optional functions that are really very helpful. I advise updating the GUI as new releases are uploaded.
  • Since STC’s portfolio consists of wide variety of 8051-based MCUs, it is possible to use the BSP header files I coded in this document and slightly modify for other STC MCUs.
  • STC should invest on a free-compiler of its own. In the past, I have criticized many Chinese semiconductor manufacturers for their lack of software support and STC doesn’t stand different from the others. The same is true for official development boards.

Finally, I would like to state that STC micros are game changers in the market of 8051-based microcontrollers. They are reliable, cheap and in fact widely used in Chinese and Asian markets. Personally, I feel delighted to have introduced them to the non-Chinese world. STC micros are without any doubt good micros for any new design.

PDF of this tutorial can be found here.

Code Examples and Libraries used in this tutorial can be downloaded from here.

All demo videos of this tutorial can be found in this Youtube playlist.

Happy coding.

Author: Shawon M. Shahryiar




Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

Related Posts


  • i always get excited when you release new tutorials ,you are really doing a great job i wish i could write code and develop libraries like you.

  • Well, this is very nice and thorough tutorial indeed, many thanks!
    Unfortunately I doubt there is good any reason to learn the STC platform beyond curiosity.
    The STC 8051, although pretty evolved from the original 8051 ISA, does not offer anything crucial to justify the relatively high price of these micros and development tools along with certain cumbersomeness of this ancient platform.
    They simply can not compete even with the legacy Cortex M0 in any way. I am even not aware about any affordable debugger/emulator for them.
    All in all, I would never recommend anybody to start learning/using any 8051 without some very good reason to do so.

Leave a Reply

Your email address will not be published. Required fields are marked *