?? main.c
字號:
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908SR12.h> /* include peripheral declarations */
void main(void) {
unsigned char temp,rxdata;
temp=0;
rxdata=0;
PTD=0;
DDRD=0xff;//output
/* include your code here */
CONFIG1=0x39;
CONFIG2=0x00; //sci clock source:CGMXCLK=9.8MHz
SCBR=0x04;//baud rate 9600 9.8M/(64*16)=9600
SCC1=0x40;
SCC2=0x0C;//enable transmitter and receiver
SCC3=0x00;
EnableInterrupts; /* enable interrupts */
while(1)
{
//while(SCS1_SCRF==0);
if(SCS1_SCRF==1)
{
rxdata=SCDR;
if(rxdata==0x55) PTD_PTD4=1;
else PTD_PTD4=0;
if(rxdata==0x00) PTD_PTD7=1;
else PTD_PTD7=0;
while(SCS1_SCTE==0);
temp=SCS1;//清除標志位
SCDR=rxdata;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -