共2条
1/1 1 跳转至页
M162 求救:关于M162串口通信的问题,谢谢!
问
求救:关于M162串口通信的问题.我的程序很简单,就是通过中断方式把接受到的数据再发出去,为什么不论发什么数据,接的数据都是0x80呢,而且发F8以上的数据就没反映,谁可以解释一下,先谢了!
#include<iom162v.h>
#include<macros.h>
#pragma interrupt_handler uart1_rxc_isr:21
void uart1_rxc_isr(void)
{
int temp;
temp=UDR1;
UDR1=temp;
}
void usart_init()
{
UBRR1H=0x00;
UBRR1L=0x33;//8MHZ,9600bps
UCSR1B=0x98;//rx complete interrupt enable,rx,tx enable;
UCSR1C=(1<<URSEL1)|(1<<UCSZ10)|(1<<UCSZ11);
}
void main()
{
usart_init();
SEI();
for(;;);
}
答 1: 搞定了,熔丝写错了。
#include<iom162v.h>
#include<macros.h>
#pragma interrupt_handler uart1_rxc_isr:21
void uart1_rxc_isr(void)
{
int temp;
temp=UDR1;
UDR1=temp;
}
void usart_init()
{
UBRR1H=0x00;
UBRR1L=0x33;//8MHZ,9600bps
UCSR1B=0x98;//rx complete interrupt enable,rx,tx enable;
UCSR1C=(1<<URSEL1)|(1<<UCSZ10)|(1<<UCSZ11);
}
void main()
{
usart_init();
SEI();
for(;;);
}
答 1: 搞定了,熔丝写错了。
共2条
1/1 1 跳转至页
回复
我要赚赏金打赏帖 |
|
|---|---|
| 基于MCP23S17的输入输出功能模块控制被打赏¥20元 | |
| 【S32K3XX】SPD 软件包使用Link文件修改被打赏¥22元 | |
| Switch-Case局部变量定义问题被打赏¥23元 | |
| 基于米尔TIAM62L开发板的串口通信及应用被打赏¥20元 | |
| PCF8574功能模块及其使用被打赏¥20元 | |
| 传感器LSM6DSO及LIS3MDL的功能检测被打赏¥18元 | |
| LPS25HB气压传感器及其检测被打赏¥18元 | |
| HTS221温湿度传感器及其检测被打赏¥18元 | |
| 【S32K3XX】HSE FW 版本更新被打赏¥21元 | |
| 基于ArduinoUNO开发板的AT24C02读写测试被打赏¥16元 | |
我要赚赏金
