{"id":265625,"date":"2015-09-15T10:04:19","date_gmt":"2015-09-15T06:04:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265625"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265625","title":{"rendered":"1-Wire slave \u043d\u0430 \u041c\u041a. \u0427\u0430\u0441\u0442\u044c 2: \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043a\u043e\u0434\u0435"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/deb\/6a7\/235\/deb6a72355ee4c04a16962c11bb05e26.png\"\/><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0446\u0438\u043a\u043b\u0430: <a href=\"http:\/\/geektimes.ru\/company\/rainbow\/blog\/260932\/\">1-Wire slave \u043d\u0430 \u041c\u041a. \u0427\u0430\u0441\u0442\u044c 1: \u0416\u0435\u043b\u0435\u0437\u043e<\/a><\/p>\n<h4>\u0427\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0438\u043d\u0435\u0442\u0440\u043d\u0435\u0442\u0435 \u043f\u043e 1-Wire slave<\/h4>\n<p>  \u0412 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e 1-Wire \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0441\u0442\u0430\u0442\u0435\u0439, application notes \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u043a\u0443\u0441 \u0438 \u0446\u0432\u0435\u0442. <br \/>  \u0410 \u0432\u043e\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b Slave \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 \u0438 \u0442\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043e\u0434\u0438\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u0434\u043b\u044f PIC, \u0441 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u043c\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438 \u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <a href=\"http:\/\/geektimes.ru\/post\/255592\/\">\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a> \u0434\u043b\u044f MSP430 \u043e\u0442  <a href=\"http:\/\/geektimes.ru\/users\/resetnow\/\" class=\"user_link\">resetnow<\/a>. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043d\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.<a name=\"habracut\"><\/a><\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435<\/h4>\n<p>  ATSAMD20G16 (<a href=\"http:\/\/components.rtcs.ru\/catalog\/detail.php?ID=433645\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043c\u0430\u0433\u0430\u0437\u0438\u043d) \u044d\u0442\u043e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0442 Atmel \u0441 \u044f\u0434\u0440\u043e\u043c Cortex-M0+. \u0415\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438:  <\/p>\n<ul>\n<li>\u041e\u0417\u0423 8 \u043a\u0431\u0430\u0439\u0442,<\/li>\n<li>Flash 64 \u043a\u0431\u0430\u0439\u0442,<\/li>\n<li>\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u0430\u043a\u0442\u043e\u0432\u0430\u044f 48 \u041c\u0413\u0446.<\/li>\n<\/ul>\n<p>  \u041f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u044f:  <\/p>\n<ul>\n<li>\u043f\u043e\u0440\u0442\u044b \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 38,<\/li>\n<li>SERCOM \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u0430\u043a uart, spi \u0438\u043b\u0438 i2c, 6 \u043c\u043e\u0434\u0443\u043b\u0435\u0439,<\/li>\n<li>\u0442\u0430\u0439\u043c\u0435\u0440\u044b, 8 \u0431\u0438\u0442, 16 \u0431\u0438\u0442, \u0432\u0441\u0435\u0433\u043e 8,<\/li>\n<li>\u0410\u0426\u041f 12 \u0431\u0438\u0442, 20 \u043a\u0430\u043d\u0430\u043b\u043e\u0432,<\/li>\n<li>\u0426\u0410\u041f 10 \u0431\u0438\u0442,<\/li>\n<li>\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a,<\/li>\n<li>\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (8 \u043a\u0430\u043d\u0430\u043b\u043e\u0432),<\/li>\n<li>\u0447\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438,<\/li>\n<li>\u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u043f\u0430\u0440\u0430\u0442\u043e\u0440\u044b, <\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e \u0434\u043b\u044f \u041c\u041a \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 <a href=\"http:\/\/geektimes.ru\/company\/rainbow\/blog\/260938\/\">Atmel Studio 6.2 + ASF<\/a>.<br \/>  \u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b:  <\/p>\n<ul>\n<li>Search rom<\/li>\n<li>Read uid<\/li>\n<li>Match rom + \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u0438 \u0440\u0435\u043b\u0435)<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u0448\u0438\u043d\u0435 OW \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435. \u0414\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u2013 \u0442\u0430\u0439\u043c\u0435\u0440 (\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 reset) \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 (\u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e). <br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u041c\u041a: \u043e\u0431\u0449\u0435\u0435 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0430\u0439\u043c\u0435\u0440, \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435, \u043f\u043e\u0440\u0442\u044b \u0432\u0432\u043e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0430.<br \/>  \u0422\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u041c\u041a 8 \u041c\u0413\u0446, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 RC-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<br \/>   <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/299\/086\/f4a\/299086f4a28c40548a2b9718f49a1012.png\"\/><br \/>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Atmel Studio \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u044b. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u043f\u043e\u0440\u0442\u043e\u0432 \u0432\u0432\u043e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b.  <\/p>\n<h5>\u0412\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 <\/h5>\n<p>  \u0414\u043b\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f (callback). <br \/>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432 ASF \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e: \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0437\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0443\u043b\u044f, \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0417\u0430\u0442\u0435\u043c \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438 \u043e\u043d\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u0414\u0430\u043b\u0435\u0435, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 (\u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043e\u0434\u043d\u043e). \u0418 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 (callback).<\/p>\n<p>  \u041a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cpp\">void configure_ext_int(void) {     \/\/----------------------channel 2-----------------------------------------       extint_chan_get_config_defaults(&eic_conf_2); \t  eic_conf_2.gpio_pin           = OW_IN_PIN_INT; \t  eic_conf_2.gpio_pin_mux       = OW_IN_PIN_MUX; \t  eic_conf_2.gpio_pin_pull      = EXTINT_PULL_NONE; \t  eic_conf_2.detection_criteria = EXTINT_DETECT_RISING;       eic_conf_2.filter_input_signal = true; \t  extint_chan_set_config( OW_IN_INT_CHANNEL, &eic_conf_2);      \t  \/\/ Register and enable the callback function  \t  extint_register_callback(extint_user_callback_2, OW_IN_INT_CHANNEL,EXTINT_CALLBACK_TYPE_DETECT); \t  extint_chan_enable_callback(OW_IN_INT_CHANNEL,EXTINT_CALLBACK_TYPE_DETECT);      } <\/code><\/pre>\n<p>  \u0418\u0437 \u043a\u043e\u0434\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0432\u044b\u0431\u043e\u0440\u0435 \u043f\u043e\u0440\u0442\u0430 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430, \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0434\u0442\u044f\u0436\u043a\u0438, \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 (\u043f\u043e \u043d\u0430\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0443).<\/p>\n<h5>\u0422\u0430\u0439\u043c\u0435\u0440<\/h5>\n<p>  \u041a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"cpp\">void configure_tc0(void) { \tstruct tc_config config_tc; \ttc_get_config_defaults(&config_tc);  \tconfig_tc.counter_size    = TC_COUNTER_SIZE_16BIT; \tconfig_tc.wave_generation = TC_WAVE_GENERATION_MATCH_FREQ; \tconfig_tc.counter_16_bit.compare_capture_channel[0] = 350;      config_tc.clock_prescaler=TC_CLOCK_PRESCALER_DIV8;     config_tc.clock_source=GCLK_GENERATOR_0;     config_tc.reload_action=TC_RELOAD_ACTION_RESYNC;  \ttc_init(&tc_instance_tc0, TC0, &config_tc); \ttc_enable(&tc_instance_tc0);         tc_stop_counter(&tc_instance_tc0); } <\/code><\/pre>\n<p>  \u0418\u0437 \u043a\u043e\u0434\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u0439\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c 16 \u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430, \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043e 350 \u0442\u0438\u043a\u043e\u0432, \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 8, \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 (8 \u041c\u0433\u0446). <br \/>  \u041e\u0441\u043e\u0431\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434. \u041e\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u00ab\u0432\u0437\u0430\u0438\u043c\u043e\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f\u00bb \u043c\u0435\u0436\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u043d\u0430 \u0448\u0438\u043d\u0435. \u0422\u0430\u043a \u043a\u0430\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ASF \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430 \u00ab\u0442\u044f\u0436\u0435\u043b\u0430\u044f\u00bb, \u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a (\u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434) \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 O3.<\/p>\n<p>  \u041a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">inline void my_delay_us(uint32_t usec) {    volatile uint32_t ctr_reg_shdw ;        ctr_reg_shdw = SysTick-&gt;CTRL; \/\/ Clear count flag by reading reg    SysTick-&gt;LOAD = (usec) * (7880000 \/ 1000000);     SysTick-&gt;VAL = 0;    SysTick-&gt;CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk; \/\/ 0x5    \/\/ wait for flag, do not need interrupts here    while (!(SysTick-&gt;CTRL & SysTick_CTRL_COUNTFLAG_Msk)); } <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043d\u0430\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0443:  <\/p>\n<pre><code class=\"cpp\">void extint_user_callback_2(void) {      if(reset_flag==0)    {       reset_flag=1; \t  tc_set_count_value(&tc_instance_tc0, 0);       tc_start_counter(&tc_instance_tc0); \t  port_pin_set_output_level(LED_0_PIN, 0);    }    else    {        tc_set_count_value(&tc_instance_tc0, 0);       reset_flag=0;     }    } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u0442 \u0442\u0430\u0439\u043c\u0435\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void tc0_callback(struct tc_module *const module_inst) {      volatile unsigned char tmp=0;    if(port_pin_get_input_level(PIN_PA04)!=0)    {       while((OW_check_in_level())!=0);       if(reset_flag==1)       {      \t\t             reset_flag=2;                  SendPresense();                  tmp=0;          tmp=get_byte();          if (tmp==0xf0)          {               search_rom();               mute_on=0;                        reset_flag=0;          }          else          {             \/\/ comeend &quot;read UID&quot;             if(tmp==0x33)             {                \/\/send UID                for(unsigned char i=0;i&lt;8;i++) send_byte(ownuid[i]);                   }             \/\/ match rom             if(tmp==0x55)             {                 \/\/ wait for own UID+ command+address                \/\/ potential problem: if less than 10 bytes received program hangs here                for(unsigned char i=0;i&lt;10;i++) in_buffer[i]=get_byte();                   \/\/ if own UID                if((in_buffer[0]==ownuid[0])&&(in_buffer[1]==ownuid[1])&&(in_buffer[2]==ownuid[2])                   &&(in_buffer[3]==ownuid[3])&&(in_buffer[4]==ownuid[4])&&(in_buffer[5]==ownuid[5])                    &&(in_buffer[6]==ownuid[6])&&(in_buffer[7]==ownuid[7]))                {                                \/\/ if command 0xA0 (reading)                   if(in_buffer[8]==0xa0)                   {                       \/\/ my_delay_us(3);                      \/\/ what address to read from?                      if(in_buffer[9]==0)                      {                                             \/\/ count crc                         registers[0]=0;                         registers[0] = OWI_ComputeCRC8(registers[1], registers[0]);                          \/\/ send value and crc                         send_byte(registers[1]);                         send_byte(registers[0]);                      } \t\t\t \u2026..                   }                    \/\/ if command 0xA1 (write)                   if(in_buffer[8]==0xa1)                   {                        write_flag=1;                      in_buffer[10]=get_byte();                      \/\/my_delay_us(3);                      \/\/ what address to write to                      if((in_buffer[9]==0)||(in_buffer[9]==1)||(in_buffer[9]==2))                      {                        \/\/nothing to do, as they are read only                      }                      if(in_buffer[9]==3)                      {                         registers[4]=in_buffer[10];                      } \u2026.                   }                }\/\/ end of if my_uid             }\/\/end of  if(tmp==0x55)          }      }\/\/end of if(reset_flag==1)    } \/\/end of if((PORTD.IN&0x01)==0)    else reset_flag=0; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u0431\u043e\u0440 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f\/\u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430.<br \/>  \u0421 \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u0430\u043c\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0440\u0435\u0448\u0435\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c inline+systick. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f\/\u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0430\u0434\u0430 \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u043d\u043e\u0433\u0435, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0442\u0430\u0439\u043c \u0441\u043b\u043e\u0442\u0430.               <\/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:\/\/geektimes.ru\/post\/262156\/\"> http:\/\/geektimes.ru\/post\/262156\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/deb\/6a7\/235\/deb6a72355ee4c04a16962c11bb05e26.png\"\/><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0446\u0438\u043a\u043b\u0430: <a href=\"http:\/\/geektimes.ru\/company\/rainbow\/blog\/260932\/\">1-Wire slave \u043d\u0430 \u041c\u041a. \u0427\u0430\u0441\u0442\u044c 1: \u0416\u0435\u043b\u0435\u0437\u043e<\/a><\/p>\n<h4>\u0427\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0438\u043d\u0435\u0442\u0440\u043d\u0435\u0442\u0435 \u043f\u043e 1-Wire slave<\/h4>\n<p>  \u0412 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e 1-Wire \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0441\u0442\u0430\u0442\u0435\u0439, application notes \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u043a\u0443\u0441 \u0438 \u0446\u0432\u0435\u0442. <br \/>  \u0410 \u0432\u043e\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b Slave \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 \u0438 \u0442\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043e\u0434\u0438\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u0434\u043b\u044f PIC, \u0441 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u043c\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438 \u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <a href=\"http:\/\/geektimes.ru\/post\/255592\/\">\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a> \u0434\u043b\u044f MSP430 \u043e\u0442  <a href=\"http:\/\/geektimes.ru\/users\/resetnow\/\" class=\"user_link\">resetnow<\/a>. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043d\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.<\/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-265625","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265625","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=265625"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265625\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}