Index

About Tongsheng TSDZ2 mid drive motors

  1. Motor controller
    1. log
  2. LCD - VLCD5
  3. Motor
  4. Torque sensor and PAS

Datasheets and application notes

  1. STM8S105S4T6

Development tools

Various

  1. 2018.04.18 - original firmware and debug session using OpenOCD
  2. 2018.04.19 - First code runs: Hello world
  3. Math operations CPU time

Math operations CPU time


Tests done with a STM8S105 running at 16MHz, SDCC 3.7.0. Interrupts were not running and the time was measured with a pin change signals on oscilloscope.

Int32_t
int32_t = int32_t + int32_t | 3.2us
int32_t = int32_t - int32_t | 3.6us
int32_t = int32_t * int32_t | 14us
int32_t = int32_t / int32_t | 132us

Floats
float = float + float | 75us
float = float - float | 75us
float = float * float | 90us
float = float / float | 175us

Floats and int32_t
float = float + int32_t | 105us
float = float - int32_t | 115us
float = float * int32_t | 130us
float = float / int32_t | 215us

Example of a long operation:
f_8 = (f_1 * f_2 * f_3 * f_4 * f_5) / (f_6 * f_7); f_8 = f_1 * f_8;
the real measured value for that operations: 775us