{"id":313906,"date":"2020-11-27T15:01:52","date_gmt":"2020-11-27T15:01:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313906"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313906","title":{"rendered":"\u041f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 ModBus Slave RTU\/ASCII \u043d\u0430 IAR AVR v3"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/o0\/vd\/de\/o0vddeal4qjdqzsae4knyigf6u8.jpeg\"><\/p>\n<p>  \u042f \u0443\u0436\u0435 \u0434\u0435\u0441\u044f\u0442\u044c \u043b\u0435\u0442 \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u043f\u043e\u0434 AVR\u2026 \u0410 \u0432\u0434\u0440\u0443\u0433 \u0440\u0430\u0437\u0443\u0447\u0438\u043b\u0441\u044f?! \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/habr.com\/ru\/post\/526350\/\">ModBus Slave RTU\/ASCII \u0431\u0435\u0437 \u0441\u043c\u0441 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/a> \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 IAR AVR, \u0430 \u0442\u0430\u043a\u0436\u0435, \u043f\u043e \u043f\u0440\u043e\u0441\u044c\u0431\u0430\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0435\u043c\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043f\u0430\u043d\u0435\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 Weintek.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043a\u0443\u0441\u0442\u0430\u0445 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0441\u044f <s>\u0440\u043e\u044f\u043b\u044c<\/s> \u043d\u043e\u0443\u0442\u0431\u0443\u043a IBM ThinkPad, \u043d\u0443\u0436\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8c\/ez\/ij\/8cezijwhe-zrfuyvxv_i8qmt7l0.png\"><\/p>\n<p>  \u0421\u043f\u0430\u044f\u043d \u0448\u043d\u0443\u0440\u043e\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440\u0430 AVReal.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e4\/fb\/tr\/e4fbtrc8yd5bscghhjvhve5ju4g.jpeg\"><\/p>\n<p>  \u0412 \u0445\u043b\u0430\u043c\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u043c\u0430\u043a\u0435\u0442\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 \u0441 ATMega48. \u0424\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u043c\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u044b \u043d\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<h4>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/h4>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u00abModBus Slave RTU\/ASCII \u0431\u0435\u0437 \u0441\u043c\u0441 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\u00bb \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430. \u0423 \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0435\u0437\u0434\u043e\u0440\u043e\u0432\u0430\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0430, \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0432\u0432\u043e\u0434\/\u0432\u044b\u0432\u043e\u0434 \u0434\u043b\u044f AVR \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0430\u0445.  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b systimer.h<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#ifndef __SYSTIMER_H #define __SYSTIMER_H  #ifdef __SYSTIMER_ASM  #define CLKSysTimer (8000000\/64)  #else #include &quot;main.h&quot; \/\/\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f void InitSysClock(void); \/\/\u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u043c\u0438\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 unsigned long Clock(void); #endif #endif <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0430\u0439\u043b systimer.asm<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#define __SYSTIMER_ASM #include &lt;iom48.h&gt; #include &quot;systimer.h&quot;  MODULE __systimer  COMMON INTVEC ORG TIMER0_COMPA_vect   rjmp tim0_comp  RSEG CODE tim0_comp:   in r10,SREG   inc r11   add r12,r11   dec r11   adc r13,r11   adc r14,r11   adc r15,r11   out SREG,r10   reti  PUBLIC InitSysClock InitSysClock:   cli   clr r11   clr r12   clr r13   clr r14   clr r15   push r16   ldi r16,(0&lt;&lt;COM0A1)|(0&lt;&lt;COM0A0)|(0&lt;&lt;COM0B1)|(0&lt;&lt;COM0B0)|(1&lt;&lt;WGM01)|(0&lt;&lt;WGM00)   out TCCR0A,r16   ldi r16,(0&lt;&lt;FOC0A)|(0&lt;&lt;FOC0B)|(0&lt;&lt;WGM02)|(3&lt;&lt;CS00)   out TCCR0B,r16   ldi r16,(CLKSysTimer\/1000)   out OCR0A,r16   ldi r16,(0&lt;&lt;OCIE0B)|(1&lt;&lt;OCIE0A)|(0&lt;&lt;TOIE0)   sts TIMSK0,r16   pop r16   reti  PUBLIC Clock Clock:   cli   movw r16,r12   movw r18,r14    reti  ENDMOD END <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f TIMER0. \u0412 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0438 \u043f\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 (COMPA), \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u043c\u0438\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0431\u0430\u0439\u0442\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0430\u044f\u0441\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 r12-r15. \u042d\u0442\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440 r11. \u0420\u0435\u0433\u0438\u0441\u0442\u0440 r10 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. <br \/>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 r12-r15, \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 Clock(), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ModBus Slave RTU\/ASCII.<br \/>  \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 <b>CLKSysTimer<\/b> \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u2014 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u043a \u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e \u0442\u0430\u0439\u043c\u0435\u0440\u0430. <\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430.  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b uart.h<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#ifndef __UART_H #define __UART_H  #ifdef __UART_ASM  #define CLK_Uart (8000000) #define UartSpeed (19200) #define FIFORX (32) #define FIFOTX (64)  #else  #include &quot;main.h&quot; void UartInit(void); unsigned short Inkey16Uart(void); void PutUart(unsigned char a);  #endif #endif <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0430\u0439\u043b uart.asm<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#define __UART_ASM #include &lt;iom48.h&gt; #include &quot;uart.h&quot; MODULE __uartrxtx  RSEG NEAR_Z rxfifo: \/\/\u0411\u0443\u0444\u0435\u0440 FIFO   DS FIFORX rxHead:\/\/\u0433\u043e\u043b\u043e\u0432\u0430, \u043f\u0438\u0448\u0435\u043c \u043d\u0430 \u0433\u043e\u043b\u043e\u0432\u0443   DS 1  rxTail:\/\/\u0445\u0432\u043e\u0441\u0442, \u0447\u0438\u0442\u0430\u0435\u043c \u0441 \u0445\u0432\u043e\u0441\u0442\u0430   DS 1  txfifo:\/\/\u0411\u0443\u0444\u0435\u0440 FIFO   DS FIFOTX txHead:\/\/\u0433\u043e\u043b\u043e\u0432\u0430, \u043f\u0438\u0448\u0435\u043c \u043d\u0430 \u0433\u043e\u043b\u043e\u0432\u0443   DS 1  txTail:\/\/\u0445\u0432\u043e\u0441\u0442, \u0447\u0438\u0442\u0430\u0435\u043c \u0441 \u0445\u0432\u043e\u0441\u0442\u0430 \u0438 \u0432 UART   DS 1   COMMON INTVEC ORG USART_RX_vect   rjmp uart_rx ORG USART_TX_vect   rjmp uart_tx    RSEG CODE \/\/void UartInit(void); PUBLIC UartInit UartInit:   sbi PORTD,0   cli   push r16   \/\/\u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439   clr r16   sts rxHead,r16   sts rxTail,r16   sts txHead,r16   sts txTail,r16   \/\/\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438   ldi r16,LOW((CLK_Uart\/8+UartSpeed\/2)\/UartSpeed-1)   sts UBRR0L,r16   ldi r16,HIGH((CLK_Uart\/8+UartSpeed\/2)\/UartSpeed-1)   sts UBRR0H,r16   \/\/Enable receiver and transmitter, \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439   ldi r16,(1&lt;&lt;RXEN0)|(1&lt;&lt;TXEN0)|(1&lt;&lt;RXCIE0)|(1&lt;&lt;TXCIE0)   sts UCSR0B,r16   \/\/Set frame format: 8data, 1stop bit, Parity No   ldi r16, (0&lt;&lt;UMSEL00)|(0&lt;&lt;UPM00)|(0&lt;&lt;USBS0)|(3&lt;&lt;UCSZ00)   sts UCSR0C,r16   \/\/\u0441\u0431\u0440\u043e\u0441 \u0444\u043b\u0430\u0433\u043e\u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 UART   lds r16,UCSR0A   ori r16,(1&lt;&lt;TXC0)|(1&lt;&lt;U2X0)    sts UCSR0A,r16   lds r16,UDR0   pop r16   reti  \/\/\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043f\u0440\u0438\u0435\u043c\u0443 uart_rx:   push r16   in r16,SREG   push r16   push XL   push XH \/\/UART-&gt;FIFO     lds r16,rxHead   ldi XL,LOW(rxfifo)   ldi XH,HIGH(rxfifo)   add XL,r16   adc XH,r16   sub XH,r16   inc r16   andi r16,(FIFORX-1)   sts rxHead,r16   lds r16,UDR0   st X,r16   pop XH   pop XL       pop r16   out SREG,r16   pop r16   reti  \/\/unsigned short Inkey16Uart(void); \/\/\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0\u04450000, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0\u044501\u0425\u0425 PUBLIC Inkey16Uart Inkey16Uart:   lds R17,rxHead   lds r16,rxTail   cp r16,r17   breq Inkey16Uart1   \/\/\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 FIFO     push XL   push XH   ldi XL,LOW(rxfifo)   ldi XH,HIGH(rxfifo)   add XL,r16   adc XH,r16   sub XH,r16     inc r16   andi r16,(FIFORX-1)   sts rxTail,r16     ld r16,X   pop XH   pop XL   ldi r17,1   ret Inkey16Uart1:   clr r16   clr r17   ret  \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 uart_tx:   push r16   in r16,SREG   push r16   push r17   \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435   lds r17,txHead   lds r16,txTail   cp r16,r17   brne uart_tx2     rjmp uart_tx_end uart_tx2:\/\/\u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0441\u0442\u044c - \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c     push XL   push XH   ldi XL,LOW(txfifo)   ldi XH,HIGH(txfifo)   add XL,r16   adc XH,r16   sub XH,r16     inc r16   andi r16,(FIFOTX-1)   sts txTail,r16     ld r16,X   sts UDR0,r16   pop XH   pop XL uart_tx_end:   pop r17   pop r16   out SREG,r16   pop r16   reti    \/\/void PutUart(char a); PUBLIC PutUart PutUart:   push XL   push XH \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435   lds XH,txHead   lds XL,txTail   cp XH,XL   brne PutUart1 \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043a\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438   lds XL,UCSR0A   sbrs XL,UDRE0   rjmp PutUart1   sts UDR0,r16   pop XH   pop XL   ret PutUart1:\/\/\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 txfifo[]     push r16   mov r16,XH   ldi XL,LOW(txfifo)   ldi XH,HIGH(txfifo)   add XL,r16   adc XH,r16   sub XH,r16   inc r16   andi r16,(FIFOTX-1)   sts txHead,r16   pop r16   st X,r16   pop XH   pop XL       ret ENDMOD END <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0445\u0435\u043c\u0435. \u041a\u0430\u043a \u043d\u0430 \u043f\u0440\u0438\u0435\u043c, \u0442\u0430\u043a \u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u043a\u043e\u043b\u044c\u0446\u0435\u0432\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435. \u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438 <b>FIFORX<\/b>, <b>FIFOTX<\/b> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0412 \u0446\u0435\u043b\u044f\u0445 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u0440\u0430\u0442\u0435\u043d 2^N (2,4,8,16,32&#8230;), \u043d\u043e \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 256. <br \/>  \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0435\u043c\u0430\/\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 <b>UartSpeed<\/b>. \u041f\u0440\u0438 \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 <b>CLK_Uart<\/b>) 8\u041c\u0413\u0446, \u0442\u043e \u0435\u0441\u0442\u044c, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e RC-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 modbus.c, IAR \u0437\u0430\u0440\u0443\u0433\u0430\u043b\u0441\u044f \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 IAR AVR \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u042199. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0443\u043c\u0435\u0435\u0442, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 <b>const<\/b>, \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0436\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 __flash. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<br \/>  \u0412 \u0444\u0430\u0439\u043b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 modbus.h \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430.  <\/p>\n<pre><code class=\"cpp\">\/\/\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440, \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u0443\u044e \u043c\u0438\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0443 #define ModBusSysTimer Clock() \/\/\u0417\u0430\u043f\u0438\u0441\u044c \u0431\u0430\u0439\u0442\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 - void ModBusPUT(unsigned char A) #define ModBusPUT(A) PutUart(A)  \/\/\u0427\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u0430 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430, - unsigned short ModBusGET(void) \/\/\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0\u04450000, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0\u044501\u0425\u0425 #define ModBusGET() Inkey16Uart() <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043e\u0432\/\u0432\u044b\u0445\u043e\u0434\u043e\u0432, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\/\u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u044b\u043c. <\/p>\n<h4>\u0414\u0435\u043c\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ModBus Slave RTU\/ASCII \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043d\u0430\u0448\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043a \u043f\u0430\u043d\u0435\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 Weintek. \u0412 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0430\u0441\u044b, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u043e\u0432, \u043c\u0438\u043d\u0443\u0442 \u0441\u0435\u043a\u0443\u043d\u0434 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b Modbus, \u043a\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 ModBus2Prg.c:  <\/p>\n<pre><code class=\"cpp\">void Prg2ModBusOutReg(void)   {\/\/\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 4\u0425 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\/\u0437\u0430\u043f\u0438\u0441\u0438   ModBusOutReg[0]=Seconds;   ModBusOutReg[1]=Minutes;   ModBusOutReg[2]=Hours;    return;   }  void Prg2ModBusInReg(void)   {\/\/\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u043e\u0432 3\u0425 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f   ModBusInReg[0]=Seconds;   ModBusInReg[1]=Minutes;   ModBusInReg[2]=Hours;     return;   } <\/code><\/pre>\n<p>  \u0427\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0447\u0442\u0435\u043d\u0438\u044f\/\u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0447\u0430\u0441\u043e\u0432:  <\/p>\n<pre><code class=\"cpp\">void ModBus2PrgOutReg(void)   {\/\/\u0447\u0442\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 4\u0425 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\/\u0437\u0430\u043f\u0438\u0441\u0438   Seconds=ModBusOutReg[0];   Minutes=ModBusOutReg[1];   Hours=ModBusOutReg[2];    return;   } <\/code><\/pre>\n<p>  \u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0432\u0445\u043e\u0434\u044b\/\u0432\u044b\u0445\u043e\u0434\u044b Modbus \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043a \u043f\u043e\u0440\u0442\u0430\u043c \u0432\u044b\u0432\u043e\u0434\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0422\u0430\u043a \u0436\u0435 \u043a \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0432\u0445\u043e\u0434\u0443 4 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043f\u043e\u043b\u0443\u0441\u0435\u043a\u0443\u043d\u0434:  <\/p>\n<pre><code class=\"cpp\">void Prg2ModBusOutBit(void)   {\/\/\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0432\u044b\u0445\u043e\u0434\u043e\u0432   ModBusOutBit[0].bit0=PORTC_Bit1;   ModBusOutBit[0].bit1=PORTC_Bit2;   ModBusOutBit[0].bit2=PORTC_Bit3;   ModBusOutBit[0].bit3=PORTC_Bit4;   return;   }  void Prg2ModBusInBit(void)   {\/\/\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043e\u0432   ModBusInBit[0].bit0=PORTC_Bit1;   ModBusInBit[0].bit1=PORTC_Bit2;   ModBusInBit[0].bit2=PORTC_Bit3;   ModBusInBit[0].bit3=PORTC_Bit4;   ModBusInBit[0].bit4=PoluSeconds;   return;   }<\/code><\/pre>\n<p>  \u0427\u0435\u0440\u0435\u0437 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u043e\u0440\u0442\u043e\u0432 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"cpp\">void ModBus2PrgOutBit(void)   {\/\/\u0447\u0442\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0432\u044b\u0445\u043e\u0434\u043e\u0432   PORTC_Bit1=ModBusOutBit[0].bit0;   PORTC_Bit2=ModBusOutBit[0].bit1;   PORTC_Bit3=ModBusOutBit[0].bit2;   PORTC_Bit4=ModBusOutBit[0].bit3;   return;   }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u043d\u0435\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0440\u0435\u0434\u0435 EasyBuilder Pro v5.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/no\/03\/re\/no03relvnc4gsv0zvai-zzlcxb4.jpeg\"><br \/>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 USB \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0430\u043d\u0435\u043b\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0435\u043d\u0430 Modbud RTU \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 COM-\u043f\u043e\u0440\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. <a href=\"https:\/\/cloud.mail.ru\/public\/57kZ\/2amvocyg9\" rel=\"nofollow\">\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u043f\u0430\u043d\u0435\u043b\u0438.<\/a><\/p>\n<p>  \u041a\u043e\u0434 \u0434\u0435\u043c\u043a\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ModBus Slave RTU\/ASCII \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u043f\u0446\u0438\u044f\u043c\u0438, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 IAR AVR v3 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c. \u041e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 3024 \u0431\u0430\u0439\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, 398 \u0431\u0430\u0439\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418\u0441\u043a\u0440\u0435\u043d\u043d\u0435 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ModBus Slave RTU\/ASCII \u043d\u0430\u0439\u0434\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Modbus \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u043d\u0430 \u043c\u0430\u043b\u043e\u043c\u043e\u0449\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. <\/p>\n<p>  <a href=\"https:\/\/github.com\/IBAH-II\/modbus-M48\" rel=\"nofollow\">\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 GitHub<\/a><br \/>  <a href=\"https:\/\/cloud.mail.ru\/public\/57kZ\/2amvocyg9\" rel=\"nofollow\">\u0412\u0438\u0434\u0435\u043e \u0434\u0435\u043c\u043a\u0438<\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/530144\/\"> https:\/\/habr.com\/ru\/post\/530144\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/o0\/vd\/de\/o0vddeal4qjdqzsae4knyigf6u8.jpeg\"><\/p>\n<p>  \u042f \u0443\u0436\u0435 \u0434\u0435\u0441\u044f\u0442\u044c \u043b\u0435\u0442 \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u043f\u043e\u0434 AVR\u2026 \u0410 \u0432\u0434\u0440\u0443\u0433 \u0440\u0430\u0437\u0443\u0447\u0438\u043b\u0441\u044f?! \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/habr.com\/ru\/post\/526350\/\">ModBus Slave RTU\/ASCII \u0431\u0435\u0437 \u0441\u043c\u0441 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/a> \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 IAR AVR, \u0430 \u0442\u0430\u043a\u0436\u0435, \u043f\u043e \u043f\u0440\u043e\u0441\u044c\u0431\u0430\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0435\u043c\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043f\u0430\u043d\u0435\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 Weintek.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-313906","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313906"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313906\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}