В данной статье пойдет речь о том, как подключить ультразвуковой дальномер HC-SR04 к ATtiny2313 и отображать данные на ЖКИ-дисплее 16×1 на базе HD44780. Также сделал пример программы для отправки результата по UART. Для приёма я использовал Terminal 1.9b и преобразователь USB-UART на базе PL2303HX. Для проверки работоспособности программы и схемы я использовал Proteus 7. Проект в Atmel Studio 7 целиком вы сможете скачать по ссылке в конце статьи. При прошивке микроконтроллера ATtiny2313 не забудьте менять фьюзы: CKSEL3…0 = 0100 – Внутренний тактовый генератор — частота 8 МГц и поставить галочку (т.е. отключить) на SCKDIV8 – деление тактовой частоты на 8.
- 1 Схема подключения TB378 и HC-SR04 к ATtiny2313
- 2 Пример программы в Atmel Studio 7
- 3 Схема подключения LCD HD44780 и HC-SR04 к ATtiny2313
- 4 Пример программы в Atmel Studio 7
- 5 Скачать файлы
- 6 Купить HC-SR04 на AliExpress
- 7 Купить ATTINY2313A на Aliexpress
- 8 Купить LCD1602 HD44780 на Aliexpress
- 9 Похожие записи
Схема подключения TB378 и HC-SR04 к ATtiny2313
Для начала сделал программу для получения данных по UART.
Пример программы в Atmel Studio 7
main.c
#define F_CPU 8000000UL #define BAUD 9600 #define MYUBRR F_CPU/16/BAUD-1 #include <avr/io.h> #include <util/delay.h> #include <string.h> #include <stdlib.h> #include "uart.h" #include "hcsr04.h" inline void prepareText(char * text, int distance) { char textDistance[5]; itoa(distance, textDistance, 10); strcat(text, "D = "); strcat(text, textDistance); strcat(text, "mm"); } int main(void) { int distance; char text[17]; USARTInit(MYUBRR); while (1) { text[0] = '\0'; distance = getDistance(); prepareText(text, distance); USARTTransmitStringLn(text); _delay_ms(333); } }
Краткое описание
Вместо функции sprintf()
сделал собственную функцию для преобразования числа в строку, потому что sprintf()
жрёт больше половины флеш памяти контроллера.
inline void prepareText(char * text, int distance)
Функция prepareText преобразует целое число distance
(расстояние) в строку и добавляет строку в text
.
itoa(distance, textDistance, 10);
Функция itoa
преобразует целое число distance
в строку textDistance
в формате 10
.
strcat(text, textDistance);
Объединение строк. Функция добавляет textDistance
строки srcptr в конец строки text
.
Результат
Так как в Протеус нету HC-SR04, я его просто нарисовал. На первой картинке результат в -1 означает что датчик HC-SR04 не подключён или Echo не отправил сигнал.
После прошивки реального ATtiny2313, подключил к компьютеру и вот результат.
Схема подключения LCD HD44780 и HC-SR04 к ATtiny2313
После того, как убедился, что датчик HC-SR04 и программа работают правильно, для вывода результата подключил однорядный ЖК на 16 символов — HD44780.
Пример программы в Atmel Studio 7
main.c
#define F_CPU 8000000UL #include <avr/io.h> #include <util/delay.h> #include <string.h> #include <stdlib.h> #include "hcsr04.h" #include "LCD.h" inline void prepareText(char * text, int distance) { char textDistance[5]; itoa(distance, textDistance, 10); strcat(text, "D="); strcat(text, textDistance); strcat(text, "mm"); } int main(void) { _delay_ms(100); lcdInit(); lcdClear(); lcdSetDisplay(LCD_DISPLAY_ON); lcdSetCursor(LCD_CURSOR_OFF); int distance; char text[17]; while (1) { text[0] = '\0'; distance = getDistance(); prepareText(text, distance); lcdClear(); lcdGotoXY(0, 0); lcdPuts(text); _delay_ms(333); } }
Результат
В Протеусе всё работает, текст отображается правильно.
Скачать файлы
ATtiny2313 + HC-SR04 + LCD — Atmel Studio 7 проект
ATtiny2313 + HC-SR04 + UART — ISIS Professional (Proteus) проект
ATtiny2313 + HC-SR04 + LCD — ISIS Professional (Proteus) проект
ATtiny2313 + HC-SR04 + UART — Atmel Studio 7 проект
ATtiny2313A даташит на Русском
ATtiny2313A datasheet (EN)
В наше время время — драгоценный ресурс, и порой его не хватает для всех нужных действий.
Одна из таких задач — получение медицинских справок для учебы.
Сейчас этот процесс значительно упрощен —
вы можете получить справку онлайн.
Заказ справок через интернет
становится востребованной услугой из-за удобства
получения. Ряд компаний предлагают оформить
разные виды справок без необходимости
ходить в больницу. Это незаменимо для
тех, кому нужна справка быстро,
например, для занятий спортом.
Существует большой выбор медицинских
справок, которые можно заказать: справка о здоровье, справка для
занятий спортом, для учебных
заведений. Заказ справки онлайн — это простой способ получить
документ в кратчайшие сроки.
Оформление справки прост и удобен.
Пользователь оформляет заказ
на сайте или через мессенджеры,
и компания оперативно подготавливает все нужные
справки. На справках ставятся
все необходимые печати, что гарантирует их легальность.
Однако, следует помнить, что
покупка медицинских документов должно происходить через проверенные компании, чтобы избежать рисков и
неприятностей и обеспечить законность
документа.
Таким образом, заказ медицинской справки через интернет
для тех, кто ценит свое время и нуждается в официальных документах.
We are a group of volunteers and opening a new scheme
in our community. Your site provided us with valuable information to work on.
You’ve done an impressive job and our whole community will be thankful to you.
canadian pharmacies online reviews
acheter viagra
order prescriptions
teva sildenafil
viagra sildenafil
площадка для продажи аккаунтов площадка для продажи аккаунтов
аккаунты с балансом биржа аккаунтов
услуги по продаже аккаунтов платформа для покупки аккаунтов
Sell Pre-made Account Marketplace for Ready-Made Accounts
Secure Account Purchasing Platform Guaranteed Accounts
Verified Accounts for Sale Account Selling Service
Account Store Sell Account
Sell Pre-made Account Account Acquisition
Accounts marketplace Sell Account
Find Accounts for Sale Buy Pre-made Account
Buy and Sell Accounts Gaming account marketplace
accounts for sale account catalog
buy and sell accounts account trading platform
database of accounts for sale account trading platform
buy and sell accounts accounts market
gaming account marketplace account trading
account selling platform marketplace for ready-made accounts
account selling platform online account store
online account store account marketplace
database of accounts for sale account trading service
find accounts for sale gaming account marketplace
ready-made accounts for sale account selling platform
gaming account marketplace account trading platform
online account store buy pre-made account
gaming account marketplace account sale
account exchange service account trading
buy account social media account marketplace
buy pre-made account account buying platform
account trading service account acquisition
database of accounts for sale account trading
ready-made accounts for sale top-social-accounts.org
account purchase https://accounts-offer.org/
accounts for sale https://social-accounts-marketplaces.live
account trading account marketplace
purchase ready-made accounts https://social-accounts-marketplace.xyz
account buying service accounts market
account buying platform https://accounts-marketplace.art
account selling service https://buy-accounts.live/
account store https://accounts-marketplace-best.pro
продать аккаунт akkaunty-na-prodazhu.pro
продажа аккаунтов магазины аккаунтов
магазин аккаунтов https://akkaunt-magazin.online/
биржа аккаунтов https://kupit-akkaunty-market.xyz/
биржа аккаунтов https://akkaunty-optom.live/
покупка аккаунтов online-akkaunty-magazin.xyz
маркетплейс аккаунтов https://kupit-akkaunt.online
facebook ad account for sale https://buy-adsaccounts.work/
buy facebook ads accounts buy facebook accounts cheap
buy facebook ads account https://buy-ad-account.top
buy accounts facebook https://buy-ads-account.click
buy facebook profiles https://ad-account-buy.top/
buy facebook ads manager buy facebook ad account
facebook ad account buy https://buy-ad-account.click
buying facebook ad account ad-accounts-for-sale.work
google ads accounts https://buy-ads-accounts.click
buy google ads agency account old google ads account for sale
buy account google ads https://ads-account-buy.work
buy google ad account https://sell-ads-account.click
google ads agency accounts https://buy-verified-ads-account.work
buy business manager account buy-business-manager.org
buy business manager https://buy-verified-business-manager-account.org
buy facebook business managers https://buy-business-manager-verified.org
buy tiktok ads account https://buy-tiktok-ads-account.org
tiktok ad accounts https://tiktok-ads-account-buy.org
tiktok ads agency account https://buy-tiktok-ads-accounts.org
buy tiktok ad account https://buy-tiktok-business-account.org
https://biotpharm.shop/# over the counter antibiotics
https://biotpharm.com/# buy antibiotics for uti
https://eropharmfast.shop/# online erectile dysfunction prescription
https://pharmau24.shop/# Buy medicine online Australia
http://eropharmfast.com/# Ero Pharm Fast
https://pharmau24.shop/# Pharm Au24
https://pharmau24.com/# Online drugstore Australia
https://viasansordonnance.shop/# acheter Viagra sans ordonnance
https://kampascher.shop/# kamagra 100mg prix
http://pharmsansordonnance.com/# pharmacie en ligne pas cher
https://pharmsansordonnance.com/# pharmacie en ligne
https://viasansordonnance.shop/# livraison rapide Viagra en France
http://kampascher.com/# acheter Kamagra sans ordonnance
https://kampascher.com/# kamagra pas cher
https://pharmsansordonnance.shop/# pharmacie en ligne france pas cher
http://ciasansordonnance.com/# commander Cialis en ligne sans prescription
https://pharmsansordonnance.com/# Pharmacie en ligne livraison Europe
https://pharmsansordonnance.com/# Pharmacie Internationale en ligne
https://viasansordonnance.com/# viagra sans ordonnance
https://pharmsansordonnance.shop/# Achat mГ©dicament en ligne fiable
https://pharmsansordonnance.shop/# pharmacie en ligne
https://pharmacieexpress.shop/# acheter antibiotique sans ordonnance
http://pharmacieexpress.com/# hemoroide pharmacie sans ordonnance
Идеални за наслояване – дамски тениски за всеки сезон
модерни дамски тениски https://teniski-damski.com/ .
Открий дамски блузи с романтична визия и ефирни материи
дамски блузи bluzi-damski.com .
https://confiapharma.shop/# farmacia 100 online
http://pharmacieexpress.com/# soolantra sans ordonnance
Современное строительство деревянных домов по европейским стандартам
заказать строительство деревянного дома https://stroitelstvo-derevyannyh-domov78.ru/ .
Услуги профессиональной уборки после ремонта и строительства
клининг https://www.kliningovaya-kompaniya0.ru/ .
https://confiapharma.com/# comprar dexabiopen sin receta
https://farmaciasubito.shop/# rabestrom 75
https://farmaciasubito.shop/# nifedicor gocce vendita online
https://farmaciasubito.shop/# arcoxia 60 mg prezzo mutuabile
http://pharmmex.com/# mexican pharmacy chicago
https://inpharm24.shop/# best pharmacy franchise in india
https://inpharm24.com/# online medicine delivery in india
Сочетание природы и роскоши: аренда яхты с панорамными видами
сочи яхты arenda-yahty-sochi23.ru .
https://inpharm24.com/# online medicine delivery in india
https://pharmmex.com/# what to buy at a mexican pharmacy
https://pharmmex.shop/# how to buy ozempic in mexico
https://pharmmex.shop/# buy mounjaro online mexico
http://inpharm24.com/# india pharmacy website
https://vgrsources.com/# buy cheap viagra online us
Натуральный рацион с кормом Jarvi без ароматизаторов и усилителей вкуса
jarvi корм для кошек разбор состава jarvi корм для кошек разбор состава .
https://vgrsources.com/# places to buy viagra
https://vgrsources.com/# sildenafil cost india
https://vgrsources.com/# cheap generic viagra fast delivery
https://vgrsources.com/# compare viagra prices uk
https://vgrsources.com/# can i order viagra
https://vgrsources.com/# where to get generic viagra online
Kaliteden ödün vermeyenler için özel seçilmiş full hd film yapımları
film izle 4k filmizlehd.co .
https://vgrsources.com/# female viagra pills in india online
https://vgrsources.com/# cost of viagra australia
https://semaglupharm.com/# Rybelsus side effects and dosage
http://lipipharm.com/# Lipi Pharm
https://prednipharm.shop/# average cost of generic prednisone
https://lipipharm.shop/# LipiPharm
http://lipipharm.com/# LipiPharm
http://lipipharm.com/# Lipi Pharm
http://lipipharm.com/# lipitor missed dose
http://prednipharm.com/# PredniPharm
https://semaglupharm.com/# FDA-approved Rybelsus alternative
https://lipipharm.com/# Generic Lipitor fast delivery
https://crestorpharm.shop/# what is rosuvastatin calcium used for
http://lipipharm.com/# LipiPharm
https://semaglupharm.com/# SemagluPharm
https://lipipharm.com/# Cheap Lipitor 10mg / 20mg / 40mg
https://prednipharm.com/# Predni Pharm
https://prednipharm.com/# prednisone in india
https://prednipharm.com/# Predni Pharm
https://semaglupharm.com/# is wegovy semaglutide
https://lipipharm.shop/# Affordable Lipitor alternatives USA