void main() { nRF24L01_Config(); SetRX_Mode(); if(MAX_RT) { SPI_RW_Reg(FLUSH_TX,0); } SPI_RW_Reg(WRITE_REG+STATUS,0xFF);// clear RX_DR or TX_DS or MAX_RT interrupt flag SPI_RW_Reg(FLUSH_RX,0); SCON =0x40; TMOD = 0x20; TH1 = 0xfd; TL1 = 0xfd; TR1 = 1; EX1=1; IT1=0; EA=1; init_1602(); while(1) { Control(); display(); if(RxBuf[0]==0xAA) { RxBuf[0]=0; //PH_dat=RxBuf[1]; temp_dat=RxBuf[2]; temp_dot=RxBuf[3]; beep_flag=RxBuf[4]; } delay1ms(10); } }
void main() { TxBuf[0]=0x00; Read_18B20_Temperature(); Read_18B20_Temperature(); delay1ms(200); Read_18B20_Temperature(); Read_18B20_Temperature(); delay1ms(200); Read_18B20_Temperature(); Read_18B20_Temperature(); delay1ms(200); nRF24L01_Config(); //初始化NRF24L01 SPI_RW_Reg(FLUSH_TX,0); EX1=1; IT1=1; EA=1; init_1602(); while(1) { Read_18B20_Temperature(); keyscan(); Control(); display(); TxBuf[0]=0xAA; TxBuf[2]=Tem_dispbuf[4]; TxBuf[3]=Tem_dispbuf[0]; TxBuf[4]=beep_flag; nRF24L01_TxPacket(TxBuf); //发送数据 delay1ms(10); } }
static int __init leds_init(void) { int ret; ret =misc_register(&misc); if(ret < 0) { printk("Unable to register misc!\n"); } bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_11, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_13, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_15, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_12, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_29, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_31, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_33, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_35, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_16, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_18, BCM2835_GPIO_FSEL_OUTP); bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_37, BCM2835_GPIO_FSEL_OUTP); init_1602(); L1602_string(1, 1, "Wait for command"); printk("ledsinit.\n"); return ret; }
void main() { init_1602(); display("0."); while(1) { keyscan(); } }
void init() { PWMInit(); init_1602(); initTimer0(); init_serial(); timePrint(); car.current = TG_START; }
//************************************主函数************************************************************ void main(void) { uchar RxBuf[20]={0}; init_1602(); init_NRF24L01() ; while(1) { //*********************************************************************************************** // SetRX_Mode(); nRF24L01_RxPacket(RxBuf); RxBuf[1] = 0x00; RxBuf[2] = 0x00; } }
//**************************Ö÷º¯Êý******************************** void main() { init_1602(); //initDisplay(); delay(500); goxy(1,0); write_cmd(0x01); show("zhaoyongke"); goxy(2,0); show(" www.ysu.edu.cn "); delay(4000); while(1); }
void main() { init_1602(); init_24c02(); init(); readtemp(); EA=1; ET0=1; TR0=0; while(1) { keyscan(); if(second==0) { if(ahour==hour&&amin==minute) { display3(); alarmflag=1; beep=0; while(alarmflag==1) { if(k1==0||k2==0||k3==0||k4==0) { alarmflag=0; write_com(0x01); beep=1; while(k1==0||k2==0||k3==0||k4==0); } } } } if(flag==0&&k3==0) { display4(); } if(flag==0&&alarmflag==0) { display1(); } if(flag==1&&alarmflag==0) { display2(); } } }
//************************************主函数************************************************************ void main(void) { uchar RxBuf[20]={0}; init_1602(); init_NRF24L01() ; led0=1;led1=1; BELL=0; Delay(100); BELL=1; while(1) { //*********************************************************************************************** // SetRX_Mode(); nRF24L01_RxPacket(RxBuf); RxBuf[1] = 0x00; RxBuf[2] = 0x00; } }