About STM8 Modules:

Quite possibly the Smallest and Least Expensive User Programmable Embedded Controller EVER with an on-board fully integrated development environment!

USA Developed and sold by a Disabled US Veteran

“Smaller than a ‘Stamp”™

The STM8S103F3P6 Minimum System Board containing STM8 BASIC Embedded™ or STM8 Compact BASIC Embedded™ is a 1.125" x .75" (30mm x 18mm) Single Board Computer containing a version of the BASIC programming language designed specifically for FAST, EASY, and INEXPENSIVE Embedded Systems Development.

If you need a very tiny, very inexpensive, very low power, and very simple to program controller for performing Controller functionality such as Analog to Digital conversion, PWM output, Digital I/O and more then the STM8S103F3P6 version of STM8 BASIC™ is exactly what you’re looking for.

Designed by an Embedded Systems Architect with 40 years embedded systems experience, using every technique they knew to squeeze an amazing amount of functionality onto a microcontroller with only 8K Flash code memory and 1K of RAM (and only uses ¾ of that RAM – the rest belongs to you!).

Yet because of just that it’s also so inexpensive that it it’s easily affordable (and easily usable) by hobbyists or students as well as professionals.

STM8 BASIC™ gives you the power and flexibility you need to program the internal peripherals of the STM8S103F3P6 microcontroller from your code – and even allows you to additionally load your own custom STM8 machine code routines into memory and execute them along with your code.

And of course, there is an Auto-Run feature that lets you decide if you want your program to run automatically on power-on or reset… it is intended to be an unattended controller after all; with such a minuscule power consumption (max 2.3 mA @ 3.3 VDC) that you can run off very small capacity batteries for extended periods of time. Excellent for use as an industrial controller or an unattended remote IoT sensor “leaf node”.

No development tools needed! Your purchase price gives you a completely self-hosted development environment with built-in editor and debugger – all the software tools you need to start your project right out of the box, it's literally plug-and-play. Your code is held in non-volatile EEPROM rated at 300K write cycles. No need to download code to your board, unless you want to of course (and the manual tells you how if you prefer editing and archiving your code on a PC).

And as for the debugger - you can optionally trace every line of execution with not just a line number, but the entire line displayed along with the value of all the variables. No need to have a listing at hand to match line numbers to lines of code, it’s all there in a single glance.

Stuck in a “forever loop”? Hit Escape and the program breaks displaying the line number last executed. Or alternatively enable the debugger and you will have a trace of every line executed along with every variable value at that moment to see just where and why you never exit the loop.

STM8 BASIC Embedded™ and STM8 Compact BASIC Embedded™ both contain almost an identical set of features, the primary difference being that STM8 Compact BASIC Embedded™ uses a “compact” syntax that takes up on average 15% to 30% less program memory to implement the exact same functionality – allowing you to fit more into your programs using less memory. On the other hand, some may prefer STM8 BASIC Embedded™ which uses a traditional BASIC syntax similar to that used by Microsoft and Commodore in their early versions of BASIC for 8-bit systems such as the Commodore 64 and original IBM-PC.

_________________________________________________________________________________________________________

SOFTWARE FEATURES:

Program in BASIC or Compact BASIC, and STM8 machine code, both bodies of code coexisting and working together at the same time.

Call built-in “helper” routines (written in C) from your BASIC or STM8 machine code, saving you time and code space.

Call your own machine code routines from your BASIC programs as easy as you would a BASIC subroutine – returns right to the next line of your BASIC code.

Programmed via on-board editor or program download in a “traditional” (think ‘C64 style’) BASIC or a “Compact” syntax version of BASIC (syntax is the only difference, functionality is the same).

Built in Debugger with Execution Trace and Display of all variables.

Full support for conveniently controlling the microcontroller via it’s device registers by providing not only Decimal but also Hexadecimal numbers, math, and display along with all of the “Bitwise” operators provided by the ‘C’ programming language (bitwise AND, bitwise OR, bitwise XOR, shift right, shift left, bitwise negation).

Operators include all standard math operators, plus a Modulo operator.

FOR/NEXT Loops can be nested, up to 8 deep

IF/THEN (and for STM8 Compact Embedded BASIC™ only, “ELSE” functionality has been added).

GOSUB/RETURN

GOTO

CLR (clear screen)

PRINT (with 5 different “usage modes”)

INPUT (console input)

SLEEP (delay seconds)

WAIT (delay tenth-milliseconds)

RST (invokes a hard system reset, not a ‘software’ reset)

USR (call a machine code or “C helper” routine)

PEEK and POKE any memory location be it RAM, EEPROM, or device register (excepting Flash memory containing the STM8 BASIC™ System which is read/copy protected). Attempting to access a non-existent or protected memory location will not result in a fault – your program will keep right on running normally.

“M-command™”, a new BASIC command exclusive to STM8 BASIC™ that works like “POKE on steroids”. Makes loading your own STM8 machine code into memory for execution (or simply just a table of data to be read and/or written) extremely simple with a minimal number BASIC code bytes.

Program can run automatically after power-up or reset via a non-volatile setting.

Code can be edited directly with the built in editor, or edited on a PC and downloaded to the editor.

Special variables, X, Y, and Z are non-volatile and will retain their value through power cycles and resets until re-written.

Variables types available are 16-bit signed integer, 16-bit unsigned integer, and 8-bit unsigned byte. Everything you need for embedded control.

One quarter of the microcontroller’s RAM has been put aside and reserved exclusively for your use.

Set your text color (ANSI terminal) to any of 7 different colors, and the color choice will be retained in non-volatile memory to be automatically applied by the Operating Environment at each power-on or reset.

_________________________________________________________________________________________________________

HARDWARE FEATURES:

With headers soldered on an STM8 BASIC module can fit in a 20-pin DIP footprint for prototyping boards and ease of layout for through-hole PCBs.

ST Microelectronics STM8S103F3P6 microcontroller running at 16MHz

Harvard architecture, 3-stage pipeline, 32-bit wide program memory bus - single cycle fetching for most instructions.

Flash Memory 8K (Not user accessible - Contains the Operating Environment, Editor, Interpreter, and Debugger – yes, it’s all packed into only 8K bytes!!)

Static RAM 1K (256 bytes reserved exclusively for the user)

640 bytes of non-volatile “true data” EEPROM with an endurance of 300 Thousand write cycles. (630 bytes available for your STM8 BASIC™ programs)

Supply voltage to board +4.5 VDC to +15 VDC.

On board voltage converter creates 3.3 VDC for the processor and LEDs.

Current consumption maximum is 2.3 milliamps (mA) @ 3.3 VDC (not including on-board LEDs), can run extended periods on small capacity batteries.

Advanced control timer: 16-bit, 4 CAPCOM channels, 3 complementary outputs, dead-time insertion and flexible synchronization

16-bit general purpose timer, with 3 CAPCOM channels (IC, OC or PWM)

8-bit basic timer with 8-bit prescaler

Auto wake-up timer

Window watchdog and independent watchdog timers

Full duplex UART with clock output for synchronous operation, SmartCard, IrDA, LIN master mode

SPI interface up to 8 Mbit/s, both Master and Slave capabilities

I2C interface up to 400 kbit/s, both Master and Slave capabilities

10-bit Analog to Digital Converter, ±1 LSB ADC with up to 4 multiplexed channels, scan mode and analog watchdog

Up to 14 Digital I/Os, including some high sink outputs, 6 with PWM output capability. Highly robust I/O design, immune against current injection.

All Digital I/Os are programmable as: Inputs - High Impedance or Weakly Pulled Up | Outputs - Open Drain or Push-Pull.

Onboard user LED (toggle port D, bit 5 to turn LED on/off), and Power on LED.

Reset Switch

Operating temperature -40C to +125C

_________________________________________________________________________________________________________

Includes a 45 page User’s Manual (downloadable pdf) including a board schematic, memory map, program listings that show you how to use STM8 BASIC’s features by example, and more. Download a copy of both manuals for STM8 BASIC Embedded™ and STM8 Compact BASIC Embedded™, then before buying you can decide which version will best suit your needs (links to manuals are below).

Manuals are freely available for download at:

For BASIC Embedded:

https://www.dropbox.com/s/iilsx3dredfwd7d/STM8EMBEDDEDBASIC_052420.pdf?dl=0

For Compact BASIC Embedded:

https://www.dropbox.com/s/sn24ppa8wuanj2o/STM8COMPACTBASICEMBEDDED_052420.pdf?dl=0 _________________________________________________________________________________________________________

IMPORTANT NOTE: This board will require either a Serial to USB converter cable (recommended) -or- a direct RS-232 serial connection to a PC serial port (a direct RS-232 connection also requires 3.3VDC <-> 5VDC level shifters for the RX and TX lines) to connect to a PC running a serial terminal program, such as Tera Term or PuTTY. Either of these inexpensive required items are almost always available for sale on Ebay and elsewhere on the web.

Note that the FTDI based Serial to USB cables are known to work on all modern versions of Windows, but the PL203 based cables will not run on Windows 8x or Windows 10 - earlier versions of Windows (7 and prior) to my knowledge are no problem for the PL203 based cables. _________________________________________________________________________________________________________

EXAMPLE ANALOG TO DIGITAL CONVERSION PROGRAM

Shown in both BASIC Embedded™ and Compact BASIC Embedded™ syntax:

Here is a small example program using STM8 BASIC Embedded™ demonstrating reading a voltage on an Analog to Digital input, sampling every half second, and printing the updated value at the upper left hand corner of the display. This program could also be modified to just as easily send the data in ASCII or binary in your chosen data format out the UART to any device you wish to have receive it using one of the ‘C helper’ functions (UserSendByte) callable from your BASIC code.

First, set up the I/O port ‘D’ as an input with no internal pull-up and I/O interrupts disabled.

1 POKE $500F,0

2 POKE $5010,0

3 POKE $5011,0

Next set ADC1 channel to AIN4 (Analog input 4) in the ADC Control Status register.

40 POKE $5400,4

Set Left-aligned result data using Configuration Register 2

60 POKE $5402,0

Enable ADC1. First POKE to Configuration Register 1 “turns on” the ADC. Subsequent invocations of the same POKE will trigger a conversion.

70 POKE $5401,1

Clear the screen

100 CLR

Trigger a conversion

105 POKE $5401,1

Wait for the conversion done bit to be set. Check the bit by reading the Control Status Register, then doing a bitwise AND using hexadecimal 80 as a bit mask on the result.

110 L=PEEK $5400

120 IF L&$80 THEN 200

130 GOTO 110

Reset the conversion complete bit.

200 POKE $5400,4

Read the result. Use byte variables X and Y to hold the high and low byte values of the result.

210 X=PEEK $5404

220 Y=PEEK $5405

Print the output, using the relationship between special variables X, Y, and Z. Z is an unsigned 16-bit variable that overlays both X and Y (like a union in the C programming language) such that X is the high byte of Z and Y is the low byte of Z. Divide the result by 19 to convert ADC counts to millivolts.

310 PRINT Z/19

Use the tenth-millisecond delay (WAIT) to wait 0.5 seconds

320 WAIT 5000

Go do it all over again until the user breaks out of the program.

400 GOTO 100

[Program size 262 bytes]

NOTE: An “END” statement is optional at the end of your program – if it’s not there the interpreter implies an “END”, in this example we leave it out as it would never be reached.

AND NOW, THE SAME EXACT PROGRAM USING STM8 Compact BASIC Embedded™ with it’s more compact syntax using fewer bytes of code to perform the same functionality:

WM = Write Memory (POKE) RM = Read Memory (PEEK) CL = Clear Screen (CLR) JP = Jump to line (GOTO) CO = Console Out (PRINT) ?: = Conditional Branch (IF/THEN) WT = Delay 10th milliseconds (WAIT)

1 WM $500F,0

2 WM $5010,0

3 WM $5011,0

40 WM $5400,4

60 WM $5402,0

70 WM $5401,1

100 CL

105 WM $5401,1

110 L=RM $5400

120 ?L&$80:200

130 JP 110

200 WM $5400,4

210 X=RM $5404

220 Y=RM $5405

310 CO Z/19

320 WT 5000

400 JP 100

[Program size 223 bytes]

_________________________________________________________________________________________________________