📜 ⬆️ ⬇️

Universal DRO based on Arduino Nano - shDRO. Part 2

Hello again!

I continue to describe my development shDRO. In this part, I will describe the device polling algorithm and the format of the console commands.

First part.

Firmware
')
Since the number of channels / ports to which reader 12 can be connected, and each channel can theoretically be set to interrupt, two PCINT interrupt handlers are used (for ports D and C). One connection restriction follows from this: all device pins that are configured for input must be connected to channels of the same group. If the channel is configured to exit, then for the current device, no matter which group it belongs to. Groups: group 1 (channels 0-5), group 2 (channels 6-11).

For interrupt handlers, two circular buffers are involved, 256 bytes each.

The interrupt handler code is:

buf[pos] = DATA_N; pos++; 

Where DATA_N is one of the ports: PIND, PINC.

Data processing is as follows:


To implement the above logic, the following logic modules are implemented in the firmware:


As a result, to connect the device, in the console you need:


Console

At the moment, I checked the console in the monitor port ArduinoIDE and in Terminal v.1.9b. For terminals like Putty you need to implement an echo mode (not implemented).

Command format:

 <> </1> <_1> </N> <_N> 

Maximum number of arguments per line 5.

Register does not matter, command parsing occurs after converting a string to lower case (exception: the value of the argument in quotes).

All commands are executed only after issuing the Setup command (exception, Help command, which lists all available commands).

All commands are described in the attached archive, as well as the first version of the firmware in hex format.

shDRO.zip (.hex + command description)

To be continued.

Thank!

PS
Commands related to configuring devices and channels can be sent to the “bare” arduinka without strapping.

PS1
Please those who live in Kazan.
If you have:

then could you give them to me for a couple of days to write and debug protocols for them?
I promise to keep them safe and sound!
But this is in a personal. Thank you in advance.

PS2
I forgot to add two commands to the command description file:
- save: saves channel and device settings to EEPROM;
- load: unloads the settings of channels and devices from the EEPROM (load is performed by the machine during initialization);
I will not upload the file, just keep in mind. But “help” displays these commands.

Source: https://habr.com/ru/post/446458/


All Articles