STM8 DISCOVERY – 7segment serial link (2)

PIC 16f884 LED display
PIC 16f884 LED display posted by (C)takao21203


Using a PIC 16f884 here to test some new ideas. All the I/O bits are now freely mapable from tables. The TRISTATE is computated by the firmware.
Actually these small displays are not very bright- or maybe there is a mysterious bug.


STM8 circuit
STM8 circuit posted by (C)takao21203


Added some shuttle boards to the STM8 Discovery PCB. The STM8 controller will have a 7seg display too. And soon there will be a serial link between the two chips. Later, a standalone STM8 chip with only 32 pins is used.<

br>
But I save a lot of time since I know PICs already. It is only ported from one C compiler to another. All the hardware dependent register names are isolated into an array. The bit-by-bit access is very slow of course.


There are large differences between PIC16F and STM8. STM8 has a larger instruction set, and many addressing modes. The address range is much larger. PIC16 has a few instructions only, very few addressing modes, and the address space is very small, there is even banking.
So the code produced from C statements is filling up the FLASH memory quickly. For a shift or bit access, many assembler instructions are produced.
The STM8 can support these operations directly.
There are more options to set on the STM8, the memory partitioning is more sophisticated, and there are multiple timers. The serial ports have a lot of features.
Compared with new technology 16F, the STM8 is more complicated, and slightly more expensive. It has however certain instructions available, which could be highly useful to speed up some tasks. On the PIC you need many instructions in a row, and this slows down things. It depends, some lookup operations don’t really take many instructions, but from C language to assembler, there is also a tradeoff. It could make a difference if you can modify bits directly or can use a matching addressing mode, or if you need to build it with many RISC instructions. It could make a difference of upto 10x.
For many programs speed is not important, but if you can reduce it more, you can also save on the battery.
The LED 7segment decoding is interesting, as all bits are set individually, from an assignment table. For each bit, a number of array access instructions is produced. So the controller needs to run much faster than if let’s say, the I/O layout is optimized, and assembler is used. In this case, you could run the PIC from a 32 KHz crystal.
Array access in C language has a price, especially if you need 5 or 6 in a row for each bit. You can run the controller at some MHz, but what if you want a larger LED matrix with random I/O bits?
Another solution is to use remapping tables but they are not so easy to compute into the FLASH, and on 16F PICs, the RAM is very limited.
Also STM8 is better here- you have more RAM, and there are certain instructions for direct bit access.


Intel Atom netbook
Intel Atom netbook posted by (C)takao21203


Intel Atom netbook- only 1GB RAM! With MPLAB, the memory used is 900MB or a little less. It is possible to open Acrobat Reader, but if a few tabs are open, and skype as well, the hard drive starts swapping for minutes.
So besides programming a serial link, and producing a prototype for serial LED display, the produced code will be examined.
PICs are very easy to use- simply mount a blank chip, add 5 wires and very few components, and it works. It remains to be seen how much effort it takes to add another STM8 chip and program it with the Discovery board.

Leave a Reply

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