Defender of Ukraine Day

Feb 23

Defender of Ukraine Day

My dears! I congratulate everyone on this holiday! In view of recent events (and in general), I have repeatedly convinced, what courageous, strong, kind and fearless men surround me. Thank you! Postscript To JS course I have here is congratulation http://programulya.com/octocats/octocats.html 🙂 Cats randomly selected but all matches are random 🙂 In view of recent events (and in general), I have repeatedly convinced, what courageous, strong, kind and fearless men surround me. Thank you! P.S. To JS course I have here is congratulation 🙂 Cats randomly selected and all matches are unexpected 🙂...

Read More

Links

Feb 01

Links

  Cats! I found the strengths and kept all our links in a single place. P.S. Further links I offer to add yourself here. Sorting, creation of new columns, replacement, and other improvements are highly appreciated 🙂...

Read More

How to Implement Data Communication Using Modbus RTU? (part 2)

Jan 12

How to Implement Data Communication Using Modbus RTU? (part 2)

So how to arrange data exchange through Modbus RTU?  Answering multiple requests and inspired by @burgua, @maxmaxmax and other people I have finally decided to write down a second part of the manual 🙂 In order to start up data exchange protocol, it is required to implement it both on master (in our case PC) and slave (board RS-485 with port). All this will work with RS-485 – USB adapter. Let’s have a look at Modbus RTU configuration implementation, where PC is a master (i.e. query sender) and a board is a slave (query responding unit). For the very beginning, one should define address chart to be completely matching address map set in the controller which we are going to use: Click to toggle codeblock 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 namespace Modbus {     public enum ModbusMap     {         ADR_STAT = 0,         ADR_ADC_STATUS = 1,         ADR_ADC_RESULT = 2,         ADR_ADC_ENG_VALUES = 12,         ADR_TIME = 22,         ADR_BINR_STATE = 25,         ADR_BINR_ATTEMPTNUM = 26,         ADR_STATUS_IOBSM = 27,         ADR_DIVISOR_COUNTER = 28,         ADR_TIME_SCALE = 29,         ADR_GSK_RES = 55,         ADR_OSK_RES = 83,         ADR_CMD = 111,         ADR_NAV_TASK_STATE = 112,         ADR_NAV_TASK_CORRECT_ORB_INDEX = 113,         ADR_NAV_TASK_CORRECT_ORB_INDEX_ITER = 114,         ADR_COUNT_GPS_DATA = 115,         ADR_COUNT_GPS_TASK = 116,         ADR_FIRST_INDEX_GPS_TASK = 117,         ADR_IS_CYCLE_READ_MODE = 118,         ADR_STORE_DIVISOR = 119     } } namespace Modbus { public enum ModbusMap { ADR_STAT = 0, ADR_ADC_STATUS = 1, ADR_ADC_RESULT = 2, ADR_ADC_ENG_VALUES = 12, ADR_TIME = 22, ADR_BINR_STATE = 25, ADR_BINR_ATTEMPTNUM = 26, ADR_STATUS_IOBSM = 27, ADR_DIVISOR_COUNTER = 28, ADR_TIME_SCALE = 29, ADR_GSK_RES = 55, ADR_OSK_RES = 83, ADR_CMD = 111, ADR_NAV_TASK_STATE = 112, ADR_NAV_TASK_CORRECT_ORB_INDEX = 113, ADR_NAV_TASK_CORRECT_ORB_INDEX_ITER = 114, ADR_COUNT_GPS_DATA =...

Read More

How to Implement Data Communication Using Modbus RTU? (part 1)

Mar 19

How to Implement Data Communication Using Modbus RTU? (part 1)

Not so long ago, I was engaged in the MC programming (in the framework of the work on the nanosatellite), in particular, I implemented a communication between devices by different protocols. So, where do we start? When it is necessary to solve this kind of problem, first of all, you should choose (if there are “hardware” restrictions, it means that the choice is partly made for us): data communication type (synchronous, asynchronous); interface (RS-232, RS-422, RS-485, USB, Bluetooth, etc.); protocol (WAKE, Modbus, etc.). To make the right choice, you need to take into account the scope, speed and signal transmission distance limits and other characteristics. One of my tasks was to implement a data communication between a computer and the STM32F105 MC on the existing board. On the interface board, there was the RS-485 for asynchronous serial data communication, which allows implementing connection of up to 32 devices at the same time, has a speed of 30 Mbit/s and a transmission distance of 1 200 m (see Table 1). Parameter RS-485 Data communication type Differential Maximum number of receivers 32 Maximum cable length 1200 m Maximum transmission rate 30 MBit/sec Output voltage -7…+12 V Receiver sensitivity ±200 mV Table 1. RS-485 interface parameters In principle, it is possible to implement a data communication without a protocol, but in this way, nobody guarantee data integrity and timely delivery, so a common practice is to use specialized protocols. Data communication protocol is a set of agreements of a logic level interface that define a data communication between different programs. These agreements define a uniform method for transmitting messages and error handling in the interaction of software of spaced apart devices, connected by one or another interface. A standardized data communication protocol also enables to develop interfaces (now at the physical level), which are not tied to a particular hardware platform and manufacturer (e.g., USB, Bluetooth). Communication protocols generally operate on the “master-slave” principle. A master initiates a communication and sends a request to slave devices (slaves), and slave devices respond (or do not respond) to requests according to the address in a package. There are many protocols, but one of the most common is Modbus. The Modbus protocol was established many years ago but is still very popular....

Read More

Meeting of Habrahabr Readers

Dec 31

Meeting of Habrahabr Readers

The meetup of readers of the Habrahabr community, popular with IT-specialists, was held On December 8. The event was very informal. Beer, peanuts, french fries… and technical presentations: Dmitry Yahov “ITIL, Methodology of IT-management Processes Within the Company”; Andrew Kobylianskii “Multidimensional Computer Graphics”; Sergei Gnidko “Work without Working Capital”; Alexander Shpak “Flexible Development Methodology. Who and why Invented them?”; Igor Petrushenko “Web Forms and Online Databases Constructor”. There were quite a few programmers at the meeting; it turned out that Habrahabr readers are mostly system administrators and integrators. It was a nice surprise for me to meet @RReverser  (you can find his blog here); we talked about Windows 8, Windows Phone and other cute .NET-stuff. Also, the organizers played beer barrels in the most honest random way (Anatoly, who was sitting at our table, was the...

Read More