|
我只想发送一次aa,bb这两个数据就行了,但是上电后一直在重复发送这两个数据,为什么不能停止,程序如下,望好心人指点迷津,先谢了
#include "io78f0411.h"
#include "intrinsics.h"
#define RXD0 P1_bit.no2
#define RXD0_DIR PM1_bit.no2
#define TXD0 P1_bit.no3
#define TXD0_DIR PM1_bit.no3
#pragma location= 0x0080
__root const unsigned char optbyte[4]={0x7e,0x01,0x00,0x03}; //0x7e:看门狗定时器允许计数,窗口周期100%,看门狗的溢出时间选择了496.48ms,内部低速振荡时钟可由软件中止
//0x01:POCMODE模式选择2.7/1。59V模式
//0x00:0082H、0083H保留区域
//0x03:允许操作,在确定片上调试安全ID失效时可以擦除Flash存储器数据
#define uchar unsigned char
uchar count=0;
void clock_init(void);
void uart0_generator(void);
void clock_init()
{
OSCCTL=0x00;
PCC=0x00;
RCM=0x80;
MOC=0x80;
MCM=0x00;
}
void uart0_generator()
{
BRGC0=0x51;
ASIM0=0x05;
POWER0=1;
TXE0=1;
PF1=0x08;
TXD0_DIR=0;
TXD0=1;
STIF0=0;
STMK0=0;
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
__no_operation();
}
void main()
{
__disable_interrupt();
IMS=0x04;
IXS=0X0c;
clock_init();
uart0_generator();
__enable_interrupt();
__no_operation();
__no_operation();
__no_operation();
TXS0=0xaa;
while(STIF0==0);
STIF0=0;
__no_operation();
__no_operation();
__no_operation();
TXS0=0xbb;
while(STIF0==0);
TXE0=0;
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|