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. 

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

2 comments

  • 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 *