?? a.c~
字號:
//頭文件
#include <mega64.h>
//
//IO方向
#define cprotb 0b1111110
#define cprotc 0b0011111
#define cportd 0x0
//清0和置1
#define set_0 0b00000001
#define set_1 0b00000010
#define set_2 0b00000100
#define set_3 0b00001000
#define set_4 0b00010000
#define set_5 0b00100000
#define set_6 0b01000000
#define set_7 0b10000000
#define clr_0 0b11111110
#define clr_1 0b11111101
#define clr_2 0b11111011
#define clr_3 0b11110111
#define clr_4 0b11101111
#define clr_5 0b11011111
#define clr_6 0b10111111
#define clr_7 0b01111111
#define qs_so (PINA&set_0)
#define clr_cs PORTA &= clr_1
#define set_cs PORTA |= set_1
#define clr_sck PORTA &= clr_2
#define set_sck PORTA |= set_2
unsigned int hsq6675();
void main()
{
unsigned int jiwd;
PORTA = 0B011;
DDRA = 0B110;
while(1)
jiwd = hsq6675();
}
unsigned int hsq6675()
{
unsigned int jiwd;
unsigned char jzsj;
float jfwd;
jzsj = 16;
jiwd = 0;
clr_sck;
clr_cs;
while(jzsj != 0)
{
set_sck;
jiwd = jiwd<<1;
if(qs_so == 0)
{
jiwd &= 0xfffe;
}
else
{
jiwd |= 1;
}
clr_sck;
--jzsj;
}
set_cs;
clr_sck;
if(jiwd&0x4 == 0)
{
jiwd = 0xffff;
}
else
{
jiwd = jiwd>>3;
}
jfwd = (float)(jiwd)*0.25;
return(jiwd);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -