avr flash_AVR | USART家庭自动化
avr flash
The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are:
通用同步和异步串行接收器和发送器(USART)是一种高度灵活的串行通信设备。 主要特点是:
Full Duplex Operation (Independent Serial Receive and Transmit Registers)
全双工操作(独立的串行接收和发送寄存器)
Asynchronous or Synchronous Operation
异步或同步操作
Master or Slave Clocked Synchronous Operation
主或从时钟同步操作
High-Resolution Baud Rate Generator
高分辨率波特率发生器
Supports Serial Frames with 5, 6, 7, 8, or 9 Data Bits and 1 or 2 Stop Bits
支持具有5、6、7、8或9个数据位和1或2个停止位的串行帧
Odd or Even Parity Generation and Parity Check Supported by Hardware
硬件支持奇偶校验生成和奇偶校验
Data Overrun Detection
数据溢出检测
Framing Error Detection
帧错误检测
Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter
噪声过滤包括错误的起始位检测和数字低通滤波器
Three Separate Interrupts on TX Complete, TX Data Register Empty, and RX Complete
TX完成,TX数据寄存器为空和RX完成的三个独立中断
Multi-processor Communication Mode
多处理器通讯模式
Double Speed Asynchronous Communication Mode
双速异步通讯模式
These are some of the features of USART, we would now lean to create a program in which we would use Bluetooth technology to open and close a LED bulb. In our program, we would take a variable X, such that if X=A our bulb will glow and if X=B the bulb will stop glowing.
这些是USART的一些功能 ,我们现在倾向于创建一个程序,在该程序中,我们将使用蓝牙技术打开和关闭LED灯泡。 在我们的程序中,我们将使用变量X ,使得如果X = A ,则灯泡将发光,如果X = B,则灯泡将停止发光。
In the similar we can also use a fan instead of LED, then we would be controlling our Fan to start or stop.
同样,我们也可以使用风扇代替LED,然后控制风扇启动或停止。
Program:
程序:
</ s> </ s> </ s>
#include <avr/io.h>
void usart_string(char*);
int main(void)
{char x;
DDRA = 0x01;
UBRRL= 51;
UCSRB= 0x18;
UCSRC= 0x86;
usart_string("Sam");
while(1)
{while((UCSRA&(1<<RXC))==0);
x=UDR;
if(x=='A')
{PORTA=0x01;
}
else if(x=='B')
{PORTA=0x00;
}
}
}
void usart_string(char*p)
{while(*p!='\0')
{UDR=*p;
while((UCSRA&(1<<TXC))==0);
UCSRA|=1<<TXC;
p++;
}
}
Explanation:
说明:
Write all the header files as written above.
像上面那样写所有的头文件。
Take a variable X which will decide whether our bulb will be ON or OFF.
取一个变量X来决定我们的灯泡是开还是关 。
DDRA=0x01 indicates that the Led bulb is connected.
DDRA = 0x01指示LED灯泡已连接。
UBRRL=51; indicates that the baud rate is set to 9600.
UBRRL = 51; 表示波特率设置为9600 。
UCSRB=0x18 means Rx and Tx are enabled.
UCSRB =为0x18装置R X和T X被启用。
The usart_string will print the word written inside it.
usart_string将打印其中写入的单词。
Inside the while loop, we have written our bulb glowing condition such that when A is received the LED will glow and when B is received the LED bulb will stop glowing.
在while循环内,我们编写了灯泡发光条件,以便当接收到A时LED发光,而当接收到B时LED灯泡停止发光。
BAUD RATE
波特率
It is the rate at which the information is processed/transferred to the communication channel.
它是信息被处理/传输到通信通道的速率。
Calculation of BAUD RATE
波特率的计算
Where, fOSC is "System Oscillator Clock Frequency".
其中, fOSC是“系统振荡器时钟频率” 。
Simulation:
模拟:
Explanation:
说明:
Select the following components:
选择以下组件:
- Atmega16
- LED Red
- From virtual instruments mode select a VIRTUAL TERMINAL
Add the components as shown in the figure.
如图所示添加组件。
Double click on ATmega16 and make its speed as 8000000 and upload the hex file in it.
双击ATmega16,使其速度达到8000000,并在其中上传十六进制文件。
When we will start the simulation a screen will appear that would be our simulation for a Bluetooth screen.
当我们开始仿真时,将出现一个屏幕,该屏幕将是我们对蓝牙屏幕的仿真。
Typing A will glow the bulb and typing B will stop the bulb from glowing.
键入A将使灯泡发光,键入B将使灯泡停止发光。
翻译自: https://www.includehelp.com/embedded-system/usart-home-automation.aspx
avr flash
avr flash_AVR | USART家庭自动化相关推荐
- 物联网、云计算商用或从“家庭自动化”得以突破
物联网与云计算的技术应用越来越广泛,其助力加快培育和发展战略性新兴产业的作用也越来越大,但由于两者在技术.商业应用上都有着不少的问题,所以一直未能实现大规模商用,现在,这一情况或因"家庭自动 ...
- 开源自动化部署工具_6种开源家庭自动化工具
开源自动化部署工具 编者注:本文最初于2016年3月发布,现已更新,以包括其他选项和信息. 自从我们上一次在2016年发布有关家庭自动化工具的评论文章以来,物联网不仅仅是一个时髦的词,而且这个事实正在 ...
- 计算机语言与智能家居的关系,来谈谈“智能家居”与“家庭自动化”的区别
原标题:来谈谈"智能家居"与"家庭自动化"的区别 大家都知道,智能家居和家庭自动化都是当下最热门的行业词了,但是我相信大部分人对他们之间的联系和区别还是模棱两可 ...
- 家庭自动化系统软件的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
本文研究全球与中国市场家庭自动化系统软件的发展现状及未来发展趋势,分别从生产和消费的角度分析家庭自动化系统软件的主要生产地区.主要消费地区以及主要的生产商.重点分析全球与中国市场的主要厂商产品特点.产 ...
- ZigBee无线传感网络家庭自动化设计
0 引言 近年来,智能家居这一概念随着物联网新技术的推动,逐渐走入人们的视野,市场需求发展空间巨大.这类新技术包括以ZigBee数传为代表的无线传感器网络,在此次智能家居系统里面将看到ZigBee数传 ...
- 开源的词法分析器_将意图分析器用于您的开源家庭自动化项目
开源的词法分析器 在Mycroft开源语音助手的本系列的第1部分和第2部分中 ,我为学习如何创建技能奠定了基础. 在第3部分中 ,我逐步创建了技能概述,并建议首先在纯Python中创建技能,以确保方法 ...
- vhs预设_使用Linux将VHS数字化,创建Bash完成脚本,Ansible,家庭自动化等
vhs预设 上周,我们最受欢迎的文章涵盖了家庭和工作场所技术的一系列有趣且实用的用途. 以下是3月19日至25日的读者最爱列表: 如何创建Bash完成脚本 ,作者Lazarus Lazaridis 作 ...
- avr flash_AVR | 掩蔽
avr flash In simple words, Masking is a process in which we hide the information that is not require ...
- 用iOS/Android实现家庭自动化远程控制
创建基于Arduino自动化系统的过程,一般解决处理问题需要大量时间. Arduino Manager 是一个app,可在iPhone和iPad上使用,用它来控制你的Arduino板,并可通过以太网. ...
最新文章
- centos vim 安装插件本质研究
- 和php交互的过程_JavaScript学习笔记(二十三) 服务器PHP
- ViewPager实现页面切换
- 计算机网络常用知识笔记(超全面)!
- 【QGIS入门实战精品教程】4.1:QGIS栅格数据地理配准完整操作流程
- Manacher算法图解
- 剑指企业级云原生,阿里云 CNFS 如何破局容器持久化存储困境
- typecho和wordpress模板了解、开发流程介绍、前台后台前端后端区分
- Confluence 6 修改警告的阈值和表现
- android系统中与内存有关的文件及路径
- 事件模型 java_事件驱动模型的简单Java实现
- 复联3观影指南丨漫威宇宙里的AI黑科技
- 数据库异常用户sa登录失败_Sa登录失败
- 中科大网上财务报销填写流程
- CH6803 导弹防御塔
- 专业语音芯片MT8516 华为AM08蓝牙音箱
- 最好用的鼠标手势软件:MacStroke for Mac
- 【面试总结】Unity3D面试题总结
- php开发俄罗斯方块,HTML5+JS实现俄罗斯方块原理及具体步骤_html5教程技巧
- 如何通过 HTML+CSS+JS 制作焦点轮播图