@ -15,7 +15,7 @@ We propose to use a compact C portable library. Compatibility with an Oled displ
It is admittedly very convenient to just use Serial.print(var); since it doesn't require you to specify the type of variable. Though when trying for example to output data in tabular style the processor needs to know the data type used so that it can reserve the adequate space for it in its output. It might seem like a big inconvenience to specify the data type with any statement that outputs data over serial but then again for debugging purposes it makes perfectly sense in terms of speed AND size of the resulting code. By the same reasons we also do not use a buffer as it is needed only in specific situations.
## Example comparison between Didel TerSer and Arduino Serial
### Example comparison between Didel TerSer and Arduino Serial
| TerSer | Output TerSer | Output Serial | Arduino Serial |
Filling the non significative digits with zero or space is a general options, named ShowZ(); and HideZ();
The Tab(nn); function, allows to align data of different types.
@ -43,3 +45,48 @@ HideZ();Dec8s(3); SetTab(15);
It is up to you to add functions like TextNL();
if you need to keep your Serial.println() habits.
### TerSer Limitations
TerSer does not print floating point numbers.
The may happen some day with one more file to import, e.g. names TerFloat.h.
Dec8(); and Dec16(); use a tricky macro to recognize the signed or unsigned data type. The parameter must be a single variable, e.g. Dec8(var); Dec8(var+2); will give wrong results.
Code will be shorter and there will be no limitation if you use Dec8u(any unsigned expr); and
Dec8s(any signed expr);, same of course Dec16u(); and Dec16s();
### Code size and timing comparison
Code size has been obtained by calling one function at a time, compiler under the usual -0s mode. Size is the difference with the empty file size. TerSer.h can of course be used with setup() and loop(). It add the ~300 bytes Arduino initializations.
Execution time has been measured with a Nop replacing the SendCar function. The time depends on the baud rate, ~1 ms per character displayed at 9600 bits/s.