master
parent 67688605d0
commit 7c4bc40665

@ -51,8 +51,7 @@ etc.
### TerSer Installation
Go to library manager in your Arduino IDE and search for 'TerSer'.
Alternatively just download the TerSer.h into your sketch folder and include it with:
Alternatively just download the TerSer.h into your sketch folder and include it directly from your sketch folder with:
`#include "TerSer.h"`
@ -70,11 +69,12 @@ The baud rate is hardwired into TerSer.h and is by default set to 9600 bps. The
```void SetupTerSer() {
UBRR0= 103; // 9600 bits/s
UCSR0B=0x18; // -- -- -- rxe txe -- -- --
UCSR0C=0x06; // set mode: 8 data bits, no parity, 1 stop bit```
UCSR0C=0x06; // set mode: 8 data bits, no parity, 1 stop bit
```
If you need another baud rate than 9600 you can adjust the value in the TerSer.h according to the table below:
| Baud rate | UBRR0 register *(@16MHz clock)* |
| Baud rate | UBRR0 register *(16MHz clock)* |
| ---------- | ---------- |
| 2400 | `UBRR0= 416;` |
| 4800 | `UBRR0= 207;` |
@ -90,23 +90,23 @@ For more information please see the [ATmega328 Datasheet](http://ww1.microchip.c
### Function reference
| TerSer function | |
| --------------- | --------------- |
| Car(cc); | Send code cc to the UART |
| cc=Get(); | Wait for a key depressed. Use Teraterm, too tricky with Arduino Terminal |
| Text("abcd"); | Send the text and add a space |
| Textln("abcd"); | Same with CRLF |
| CR(); | Send a CR-LF |
| Bin8(v); | Display the 8 low bits of the variable v, converted to integers (all add a space) |
| Bin16(v); | Display the 16 bits of the variable v, with a dot in the middle |
| Hex8(v); | Display the 2 nibbles of the variable v, converted to integers |
| Hex16(v); | Display the 4 nibbles of the variable v, converted to integers |
| Hex32(v); | Display the 8 nibbles of the variable v, converted to integers |
| Dec8(v); | Display the variable v, with its signs if signed and non-significative space or zeros |
| Dec16(v); | Display the variable v, with its signs if signed and non-significative space or zeros |
| Dec8u(unsigned); Dec8s(signed); | Shorter code |
| Dec16u(unsigned); Dec16s(signed); | Shorter code |
| Normal(); | ..+nnn default mode (a dot represents a space) |
| Spaces(); | +..nnn best for tabular data |
| Zeros(); | +00nnn if you prefer |
| Compact(); | +nnn same as Arduino, but a + is shown if positive signed variable |
| `Car(cc);` | Send code cc to the UART |
| `cc=Get();` | Wait for a key depressed. Use Teraterm, too tricky with Arduino Terminal |
| `Text("abcd");` | Send the text and add a space |
| `Textln("abcd");` | Same with CRLF |
| `CR();` | Send a CR-LF |
| `Bin8(v);` | Display the 8 low bits of the variable v, converted to integers (all add a space) |
| `Bin16(v);` | Display the 16 bits of the variable v, with a dot in the middle |
| `Hex8(v);` | Display the 2 nibbles of the variable v, converted to integers |
| `Hex16(v);` | Display the 4 nibbles of the variable v, converted to integers |
| `Hex32(v);` | Display the 8 nibbles of the variable v, converted to integers |
| `Dec8(v);` | Display the variable v, with its signs if signed and non-significative space or zeros |
| `Dec16(v);` | Display the variable v, with its signs if signed and non-significative space or zeros |
| `Dec8u(unsigned); Dec8s(signed);` | Shorter code |
| `Dec16u(unsigned); Dec16s(signed);` | Shorter code |
| `Normal();` | ..+nnn default mode (a dot represents a space) |
| `Spaces();` | +..nnn best for tabular data |
| `Zeros();` | +00nnn if you prefer |
| `Compact();` | +nnn same as Arduino, but a + is shown if positive signed variable |

Loading…
Cancel
Save