Home > other >  Great god explain the flow chart of this work, a little careful NRF905
Great god explain the flow chart of this work, a little careful NRF905

Time:09-19

#include
# define uint unsigned int
# define uchar unsigned char

Sbit DQ1=P2 ^ 0; A definition to use single chip microcomputer P20//sensor port
Sbit DQ2=P2 ^ 1;//sensor B defined using single chip microcomputer P21 port
Sbit DQ3=P2 ^ 2;//sensor C defined using single chip microcomputer P22 port
Sbit DQ4=P2 ^ 3;//sensor D defined using single-chip microcomputer P23 port
Sbit DQ5=P2 ^ 4;//sensor E defined using MCU P24 port

Unsigned char car_num=0;//parking numerical
Unsigned char Set_car_H=5;//set the car Numbers in
Signed char s_car_num=0;//remaining parking numerical

Uchar, flag1, flag2;//set the two flags
Uchar flag3 flag4;//set the two flags
Uchar flag5 flag6;//set the two flags
Uchar flag7 flag8;//set the two flags
Uchar flag9 flag10;//set the two flags

Uchar N1=0, next 11=0;//a car or no marks
Uchar N2=0, N22=0;
Uchar N3=0, N33=0;
Uchar N4 interchange=0, N44=0;
Uchar N5=0, N55=0;

C # include "nrf905."

Void jishu ();
Void campare_display ();

Void delay_us (uint z)//delay
{
Uint a, b;
For (a=z; Z> 0; Z -)
For (b=110; B> 0; B -);
}
///////////////////////////////////////////////////////////////
/* * * * * * * * * * * * * * * * * * the main function of * * * * * * * * * * * * * * * * * * * * * * * */
Void main ()
{

Uchar num.
NRF905Init ();//initialization of NRF905
Config905 ();//configure wireless modules NRF905
TxBuf [0]=1;//module
While (1)
{
Jishu ();//parking statistics
Campare_display ();//parking number recognition

TxBuf [1]=car_num/10;//10
TxBuf [2]=car_num % 10;//个位
num++;
If (num==2) {//module
Num=0;
TX ();//send
}

}
}
Void campare_display ()//compare
{

If ((N1==1) | | (n==1) | | (N3==1) | | (N4 interchange==1) | | (N5==1) {
If (N1==1) {
TxBuf [3]='A';

}
The else {
TxBuf [3]=0;
}
If (n==1) {

TxBuf [4]='B'.

} else {

TxBuf [4]=0;
}
If (N3==1) {

TxBuf [5]='C';
} else {

TxBuf [5]=0;
}
If (N5==1) {

TxBuf [6]='D';
} else {

TxBuf [6]=0;
}
If (N4 interchange==1) {

TxBuf [7]='E';
} else {

TxBuf [7]=0;
}
} else {
//Lcd_ShowSring (1, 0, "");

}




}

//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Void jishu ()//statistical number of parking Spaces function
{

If (DQ1==0)//parking 1
{
Delay_us (5);//similar to shake
If (DQ1==0)
{
Flag1=1;//flag bit flag1

}
}

If (flag1==1)//flag1=1 A infrared sensor for detecting tube to show cars
{
Delay_us (5);
If (N1==0) {
Car_num + +;//parking numerical add 1
N1=1;
}//
Flag1=0;//clear sign a
Flag2=1;//start sign
N11=0;

}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related