{"id":255775,"date":"2015-04-22T11:50:02","date_gmt":"2015-04-22T07:50:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=255775"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=255775","title":{"rendered":"\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 GSM \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0441 AVR"},"content":{"rendered":"<p> \t\t\t\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430: \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 AVR \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u043c GSM \u043c\u043e\u0434\u0443\u043b\u0435\u043c (\u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043c\u043e\u0434\u0443\u043b\u044c TC35 \u043e\u0442 SIEMENS, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0432\u044f\u0437\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 RS232). \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c.<\/p>\n<p>  \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438. \u0412\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e 6 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 6 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432. \u0414\u043b\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0431\u044b\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u044b 3 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 (Ready, Send, Error), \u043d\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u043d\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 LCD 16&#215;2 (\u0441\u043a\u043e\u0440\u0435\u0435, \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0435\u043c \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f).<\/p>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0434\u0435\u043b\u043e \u043d\u0430 \u043f\u043b\u0430\u0442\u0435 Pinboard II (Rev 2) \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043d\u0430 ATmega16. \u041d\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441\u0445\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0439 (\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f ATmega8). \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0438\u0441\u0430\u043b\u0430\u0441\u044c \u0432 AVR Studio 4.19. \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b (#include) \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 Pinboard \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c.<\/p>\n<p>  \u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/we.easyelectronics.ru\/attachments\/get\/1708\" alt=\"image\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u0438\u043b\u0435\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u043f\u043b\u0430\u0442\u043a\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/we.easyelectronics.ru\/attachments\/get\/1705\" alt=\"image\"\/><\/p>\n<p>  \u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u044f \u0437\u0430\u043a\u0430\u0437\u0430\u043b \u043f\u043b\u0430\u0442\u044b \u0443 \u043a\u0438\u0442\u0430\u0439\u0446\u0435\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/we.easyelectronics.ru\/attachments\/get\/1710\" alt=\"image\"\/><\/p>\n<p>  \u0410 \u043a\u043e\u0433\u0434\u0430 \u0441 \u0436\u0435\u043b\u0435\u0437\u043e\u043c \u0431\u044b\u043b\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043e, \u0441\u043b\u0435\u0434\u043e\u043c \u043f\u043e\u0448\u0451\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u0441\u0451 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 \u0421\u0438 \u043f\u043e\u0434 AVR Studio 4.19. \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u043e \u043f\u043e\u043a\u0430 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u0441 GSM \u043c\u043e\u0434\u0443\u043b\u0435\u043c.<\/p>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c AT \u043a\u043e\u043c\u0430\u043d\u0434 \u0435\u0441\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u0435\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u041d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cpp\">\/\/\u043a\u043e\u043c\u0430\u043d\u0434\u0430: AT+CMGF=1&lt;enter&gt; \/\/\u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044f: OK&lt;enter&gt; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0436\u0438\u043c. \u0426\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0440\u0435\u0436\u0438\u043c \u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0441\u0432\u043e\u0438\u043b (\u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438). \u041e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0430\u0434\u0438\u044f\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f. \u041d\u043e \u043f\u043e\u0442\u043e\u043c (\u043a\u043e\u0433\u0434\u0430 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u0435\u0448\u0438\u0444\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434) \u0441\u043b\u0443\u0436\u0438\u043b \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u0418\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<pre><code class=\"cpp\">\u043a\u043e\u043c\u0430\u043d\u0434\u0430: AT+CMGS=(\u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430)&lt;enter&gt; \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044f:  &gt; \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: Hello, GSM module!&lt;ctrl-Z&gt; \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044f: +CMGS: 62  OK <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435 Enter (0x0D) \u0430 CTRL-Z (0x1A). \u041e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u0432\u0430 <a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BB%D1%8C%D1%86%D0%B5%D0%B2%D0%BE%D0%B9_%D0%B1%D1%83%D1%84%D0%B5%D1%80\">\u043a\u043e\u043b\u044c\u0446\u0435\u0432\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u0430<\/a> \u0441\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438:<\/p>\n<pre><code class=\"cpp\">#define BUF_SIZE 128 #define BUF_MASK (BUF_SIZE-1) #define IN_BUF_SIZE 64 #define IN_BUF_MASK (IN_BUF_SIZE-1)  volatile char buffer[BUF_SIZE]=&quot;&quot;; volatile char inbuf[IN_BUF_SIZE]=&quot;$&quot;; \/\/inner buffer of USART volatile uint8_t ind_in=0, ind_out=0, rxind_out=0, rxind_in=0, mess = 0; <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0438\u0441\u044c \u0441\u0442\u0440\u043e\u043a \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">\/\/sending RS232 with interupt void SendByte(char byte)         {         buffer[ind_in++] = byte;         ind_in &= BUF_MASK;         }  void SendStr(char *string)         {         while (*string!='\\n')  \/\/check if End                 {                 SendByte(*string);                 string++;                 }         } <\/code><\/pre>\n<p>  \u0410 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">\/\/Sending data from buffer ISR (USART_UDRE_vect)                    {         UDR = buffer[ind_out++];  \/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430         ind_out &= BUF_MASK;      \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043c\u0430\u0441\u043a\u0438 \u043a\u043e\u043b\u044c\u0446\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430         if (ind_in == ind_out)  \/\/\u0435\u0441\u043b\u0438 \u0431\u0443\u0444\u0435\u0440 \u0443\u0436\u0435 \u043f\u0443\u0441\u0442                 {                 UCSRB &= ~(1&lt;&lt;UDRIE); \/\/disable instrupt UDR empty                 UCSRB |= (1&lt;&lt;RXEN);   \/\/\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0451\u043c\u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438                 }         sei ();         } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0431\u0443\u0444\u0435\u0440 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \\n), \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0443\u0441\u0442\u043e\u0448\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 (UDR):<\/p>\n<pre><code class=\"cpp\">SendStr(&quot;AT+CMGF=1\\n&quot;); SendByte(CR);    \/\/\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c &lt;Enter&gt; (0x0D) UCSRB &= ~(1&lt;&lt;RXEN);   \/\/\u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u043f\u0440\u0438\u0451\u043c \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 UCSRB |= (1&lt;&lt;UDRIE);   \/\/\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 <\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u0438\u0434\u0451\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u043d\u0430 LCD \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c (delay).<br \/>  \u041f\u0438\u0441\u0430\u0442\u044c \u0432 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432 \u0431\u0443\u0444\u0435\u0440 \u043d\u0435\u043b\u044c\u0437\u044f. \u041e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435 \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434. \u0410 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0444\u0435\u0440 \u043f\u0443\u0441\u0442 (\u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0440\u0430\u0432\u043d\u044b).<\/p>\n<p>  \u0418 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 (\u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u044f \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e \u043f\u043e\u0440\u0442) \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">while (1)     {     tmp = PINC;     switch (tmp)         {         case 1:  send_sms(0,NUM1); break;         case 2:  send_sms(0,NUM2); break;         case 3:  send_sms(0,NUM3); break;         \/\/\u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435...         default: break;         }     Ready_Snd (); \/\/\u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0440\u0435\u0436\u0438\u043c \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438     } <\/code><\/pre>\n<p>  \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u044f \u043f\u043e\u0441\u044b\u043b\u0430\u044e \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (\u0438\u0445 \u0443 \u043c\u0435\u043d\u044f 2 \u0442\u0438\u043f\u0430) \u0438 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<br \/>  \u041c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0437\u0432\u043e\u043d\u043e\u043a \u0442\u0435\u043c\u0438 \u0436\u0435 AT \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438. \u0412\u0441\u0451 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u0430\u043d\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, OK, RING, ERROR\u2026<br \/>  \u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043c\u043e\u0433 \u043e\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0435\u0451 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0437\u0432\u043e\u043d\u043e\u043a. \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<pre><code class=\"cpp\"> RING  RING  RING <\/code><\/pre>\n<p>  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043c\u043e\u0434\u0443\u043b\u044f, \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0449\u0451 \u0438 \u043d\u043e\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0442\u043e \u0437\u0432\u043e\u043d\u0438\u0442. \u041f\u043e\u043a\u0430 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0438\u0447\u0435\u0433\u043e \u0441 \u044d\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 (\u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435) \u0438\u043b\u0438 (\u0432 \u0445\u0443\u0434\u0448\u0435\u043c) \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0442\u043e \u043d\u0435 \u0442\u043e, \u0430 \u0442\u043e \u0438 \u0432\u043e\u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u043d\u0435\u0442 (\u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f).<\/p>\n<p>  \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u043e\u0434\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<br \/>  1. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e. \u041f\u043e\u0442\u043e\u043c \u0443\u0436\u0435 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  2. \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435. \u0414\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b $.<\/p>\n<p>  3. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043a\u043e\u0434\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, OK \u0431\u0443\u0434\u0435\u0442 1, ERROR \u2014 4, RING \u2014 2.<\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">#define BUF_SIZE 128   \/\/\u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0431\u0443\u0444\u0435\u0440 #define BUF_MASK (BUF_SIZE-1) #define IN_BUF_SIZE 64 \/\/\u0412\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0431\u0443\u0444\u0435\u0440 #define IN_BUF_MASK (IN_BUF_SIZE-1)  volatile char buffer[BUF_SIZE]=&quot;&quot;; volatile char inbuf[IN_BUF_SIZE]=&quot;$&quot;; \/\/inner buffer of USART volatile uint8_t ind_in=0, ind_out=0, rxind_out=0, rxind_in=0, mess = 0; volatile uint8_t com_detect=0;  \/\/\u0441\u044e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430  #define TIMEOUT 100     \/\/\u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u0430 <\/code><\/pre>\n<p>  \u041f\u0438\u0448\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0451\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"cpp\">\/\/recieving Data from RS232 ISR (USART_RXC_vect)             {         uint8_t tmp;         tmp = UDR;         if (tmp == 0x0D)        \/\/\u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043a\u043e\u043d\u0435\u0446 \u043a\u043e\u043c\u0430\u043d\u0434\u044b - &lt;enter&gt;                 {                 mess++; \/\/one more message                 inbuf[rxind_in++] = '$'; \/\/\u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0432 \u0431\u0443\u0444\u0435\u0440                 rxind_in &= IN_BUF_MASK;                 }     else                  {                 if (tmp != 0x0A) \/\/\u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u044f                         {                         inbuf[rxind_in++] = tmp;   \/\/\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0443\u0444\u0435\u0440                         rxind_in &= IN_BUF_MASK;                         }                 }         sei (); } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0431\u0443\u0444\u0435\u0440\u0435. \u041c\u043e\u0436\u043d\u043e \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e mess \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e \u2014 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f LCD \u044d\u043a\u0440\u0430\u043d\u0430. \u0417\u0434\u0435\u0441\u044c \u044f \u0438\u0445 \u043f\u0440\u043e\u043f\u0443\u0449\u0443 \u0437\u0430 \u043d\u0435\u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<pre><code class=\"cpp\">void rx_check_in (void)     {     uint8_t count=0;     com_detect = 0;  \/\/\u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043c\u0435\u0448\u0430\u043b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043c\u0443\u0441\u043e\u0440)     while (1)         {         if (inbuf[rxind_out] != '$') \/\/\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0435\u0446 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c)                 {                 com_detect ^=  inbuf[rxind_out++]; \/\/\u0434\u0435\u043b\u0430\u0435\u043c XOR \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c                 rxind_out &= IN_BUF_MASK;                 count++;  \/\/\u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435                 }         else                  {                 rxind_out++;                 rxind_out &= IN_BUF_MASK;                 code_com (count);           \/\/!! \u0432\u0430\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c - \u0440\u0430\u0441\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443                  break;                 }         }     } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043c\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u044f\u0441\u043e\u0440\u0443\u0431\u043a\u0443. \u0414\u0435\u043b\u0430\u0435\u043c XOR \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 (\u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d \u043d\u0430 \u0441\u0447\u0451\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0432\u043e\u0434\u0438\u043b\u043e). R^I^N^G \u043d\u0430\u043c \u0434\u0430\u0441\u0442 0x12. O^K \u0434\u0430\u0441\u0442 0x04. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435) \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 com_detect (\u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f) \u0438 count. \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a:<\/p>\n<pre><code class=\"cpp\">void code_com (uint8_t count)         {         switch (com_detect)                 {                 case (0x12): if (count == 4) com_detect = 2; break; \/\/R^I^N^G                 case (0x58): if (count == 5) com_detect = 3; break; \/\/ERROR                 case (0x04): if (count == 2) com_detect = 1; break; \/\/OK                 case (0x5C): if (count == 3) com_detect = 4; break; \/\/ATI                 default: com_detect = 0;                 }         } <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u044f \u0432\u0432\u0451\u043b \u0434\u043b\u044f \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0432 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 XOR \u043a\u043e\u0434 \u0441\u043e\u0432\u043f\u0430\u0434\u0451\u0442. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c. \u041d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c (\u0438\u043b\u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u043c) XOR \u043a\u043e\u0434 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0439 \u0446\u0438\u0444\u0440\u0443.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 com_detect \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c SMS \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a:<\/p>\n<pre><code class=\"cpp\">while (1)     {     if (mess != 0) \/\/if we have mess in buffer         {         \/\/ code          mess--;   \/\/minus one         rx_check_in ();  \/\/\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0451\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443         if (com_detect == 2)   \/\/\u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 RING (\u043a\u043e\u0434 2)             {                                  \/\/\u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435                                                 \/\/ \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (OK)             if (!send_sms (1,NUM0)) ErrMes (); \/\/\u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b OK             }                                  \/\/\u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430         com_detect = 0; \/\/\u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443     } <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  \u0418\u0442\u043e\u0433: \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0443\u043c\u0435\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0438 \u0443\u043c\u0435\u0435\u0442 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442 GSM \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<p>  <a href=\"http:\/\/we.easyelectronics.ru\/attachments\/get\/1714\">\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f Pinboard II<\/a> \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440. \t\t\t<\/p>\n<div class=\"clear\"><\/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=\"http:\/\/habrahabr.ru\/post\/256349\/\"> http:\/\/habrahabr.ru\/post\/256349\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p> \t\t\t\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430: \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 AVR \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u043c GSM \u043c\u043e\u0434\u0443\u043b\u0435\u043c (\u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043c\u043e\u0434\u0443\u043b\u044c TC35 \u043e\u0442 SIEMENS, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0432\u044f\u0437\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 RS232). \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c.<\/p>\n<p>  \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438. \u0412\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e 6 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 6 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432. \u0414\u043b\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0431\u044b\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u044b 3 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 (Ready, Send, Error), \u043d\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u043d\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 LCD 16&#215;2 (\u0441\u043a\u043e\u0440\u0435\u0435, \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0435\u043c \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f).<\/p>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0434\u0435\u043b\u043e \u043d\u0430 \u043f\u043b\u0430\u0442\u0435 Pinboard II (Rev 2) \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043d\u0430 ATmega16. \u041d\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441\u0445\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0439 (\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f ATmega8). \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0438\u0441\u0430\u043b\u0430\u0441\u044c \u0432 AVR Studio 4.19. \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b (#include) \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 Pinboard \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c.<\/p>\n<p>  \u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/we.easyelectronics.ru\/attachments\/get\/1708\" alt=\"image\"\/>  <\/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-255775","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255775","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=255775"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255775\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}