?? sh607.c
字號:
#include <reg52.h>
#include <absacc.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define uchar unsigned char
#define uint unsigned int
uint numyaw,numroll,numpitch;
#define dsyawh XBYTE[0x0600] // 定義雙端口RAM中的存儲單元地址;
#define dsyawl XBYTE[0x0100]
#define dspitchh XBYTE[0x0200]
#define dspitchl XBYTE[0x0300]
#define dsrollh XBYTE[0x0400]
#define dsrolll XBYTE[0x0500]
sbit P1_2=P1^2;
//主函數,初始化串口和變量
main()
{
TMOD=0x20;
TL1=0xfd;
TH1=0xfd;
SCON=0x50;
PCON=0x00;
IE=0x90;
TR1=1;
P1_2=1;
while(1);
}
// 由于采用的是專用的通信單片機,可以使用中斷方式進行串行通信,提高通信質量。
serial () interrupt 4 using 1
{
RI=0; //軟件清除中斷標志位
//判斷是否收到HPR格式語句的第一個字符"$",其數值為0x24,如果收到,則開始記錄數據,
if (SBUF==0x24)
{
// …… 省略數據的記錄,詳細內容見前文的HMR3000數字羅盤和單片機的通信實例
}
// numyaw=atoi(stringyaw);
// numpitch=atoi(stringpitch);
// numroll=atoi(stringroll);
// 將數據寫入雙端口RAM,并返回初始值;
dsyawh=numyaw/256;
dsyawl=numyaw%256;
dspitchh=numpitch/256;
dspitchl=numpitch%256;
dsrollh=numroll/256;
dsrolll=numroll%256;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -