當前位置:首頁 » 編程語言 » c語言檢測電平
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言檢測電平

發布時間: 2023-08-20 20:37:10

① 51單片機檢測引腳電平變化的C語言程序

#include <reg52.h>
sbit LED0 = P0^0; sbit LED1 = P0^1; sbit LED2 = P0^2; sbit LED3 = P0^3;
sbit LED4 = P0^4; sbit LED5 = P0^5; sbit LED6 = P0^6; sbit LED7 = P0^7;
sbit LED10 = P1^0;
void main() {
LED0 = 0; LED1 = 0; LED2 = 0; LED3 = 0; LED4 = 0; LED5 = 0; LED6 = 0;
LED7 = 0;
LED7 = 1;//假設有變化

if(LED7) {
LED10 = 1;
LED0 = 1; LED1 = 1; LED2 = 1; LED3 = 1; LED4 = 1; LED5 = 1; LED6 = 1; }
}