Exploring STC 8051 Microcontrollers – Coding
Communication Hardware Overview
STC8A8K64S4A12 packs all kinds of common communication hardware peripheral that most modern microcontrollers can offer. The following are available in STC8A8K64S4A12’s arsenal:
As always, we also have options for software-based communications. Using some coding, we can implement software-based SPI, I2C and other forms of communications. One wire communication is a good example. One wire communication is fully implemented in software. Using a combination of hardware and software, we can also implement methods to decode IR communication.
Though software methods will rarely be needed, these methods allow us to understand the working principle of different communication methods and in this way build confidence for coding devices that do not follow standard I2C, SPI or UART methods. The downside of software communications is their relative processing speed when compared with their hardware counterparts because software-based communications are made virtually in codes rather than in physical hardware.
I won’t be discussing much about the software techniques because in all of my past tutorials, I have been discussing about them briefly and most of these stuffs are mere confirmation of implementation and repetition.
UART offers long-distance serial communication and can also be employed for simple SPI-like serial and industry-standard RS-485 communications. STC8A8K64S4A12 has four UART hardware with independent interrupts. UART1 is the most advanced UART of all. All UART hardware peripheral need a timer for baud rate generation. Timer 2 is common to all of these UARTs and so it is wise to leave it for UARTs. All of these UART have multiple alternative pins associated with them. These pin mapping is summarized below:
I2C hardware available in STC8A8K64S4A12 is very simple but it offers lot of flexibilities. The I2C block can be used in both I2C master or slave roles. Just like UART it has lot of alternative pin pair options as the table below shows.
SPI hardware is also fully implemented in STC8A8K64S4A12. Using the SPI hardware is very simple and like other communication peripherals, we have options to use various alternative GPIO pin groups. Both SPI and I2C blocks are fully independent blocks unlike UARTs as UART blocks are dependent on internal hardware timers.
Hi, I am using STC MCU since 10 years. Tech support is ZERO. but they are low cost, very stable. Now I have a problem when the chip that I used is obsolete. Now start to use STC8C2K64S4-28I-LQFP32 but no stc8Cxx.h file, I am using stc8Hxx.h file which compiles but in some stage freeze, the existing firmware. With stc8hxx.h file I can compile STC8F2K64S4-28I-LQFP32 and works not bad
I wrote them many times for the stc8Cxx.h file never got answer. Where Can I find that file?
Give me detail 8f2k64s281MCU read and write programmer
Give me detail 8f2k64s281reed and write programmer distal
Hi. Can you explain how to use I2C in the slave mode ?
Thanks for these tutorials. I’m getting back into STCmicro coding now, having left them alone for the past several years. Back then I only used the STC89C52RC (and C54RD) but this time I’m also using the more powerful STC15 and STC8 types. Your blogs provide a wealth of useful information.
You have done great job with all these tutorials. I am an electronics engineer trying to learn some new stuff. I am located in Greece , Europe and I would like to purchase the development board that you are using and download some datasheets in English if possible but I cannot find them anywhere. Could you please help me?
I suggest you buy from AliExpress or similar platform that is available in your country…. You can find the English datasheet here. English documentation can be found in STC’s official websites such as this one….
Thank you very much for your help!!!
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.