Combining the previously implemented Modbus acquisition and MQTT transmission JSON data framework, today we will integrate and build a basic data acquisition and transmission device framework. The main function creates a data collection task, a network task, and a system operation task
The network transmission task schedules the transmission task, packages the data collected by Modbus into a JSON string, and then pushes it out through the MQTT protocol
The network transmission task regularly polls to receive data and parses the received JSON string. The simplest way is to process the status of the light.
Through the MQTT client, we can see that the device has been pushing data, and the sent data can be correctly parsed, and the lights on the board will change with the issued commands.
After testing for a day, it is relatively stable. The above is the application task goal. Attach the source code of the project 393387, unzip it in the directory of SDK_2.4.2_MIMXRT1052xxxxB\boards\EasyARM-RT1052-V1_0\demo_apps, and the keil version is V5.26.2.0. Finally, let me talk about my experience of using it for a while. Hardware: Zhou Ligong has been doing industrial design for many years, and the EMC, power supply, layout, and data are all very standardized, which is worth learning and recommending; Software: Because there are many peripheral routine references, it is not difficult to get started, but when debugging the program, you will often encounter various strange problems such as the emulator cannot detect the chip, which is quite uncomfortable. Other NXP chips do not have this problem, that is, the problem of RT1052. I don’t know if other people have the same feeling after using it. Then the overall function of the chip is indeed very powerful, with rich peripheral functions and processing speed, which are all top-level in MCU, but the startup process and memory management of the chip are still relatively complicated (probably because it does not have an internal ROM). If it is really used in practice, it still needs to be studied carefully. The above, skr~~~ This content is originally created by ID.LODA, a user of EEWORLD forum. If you need to reprint or use it for commercial purposes, you must obtain the author’s consent and indicate the source.