Home > other >  A switch machine control function, help please see can achieve.
A switch machine control function, help please see can achieve.

Time:02-10

Themselves, nobody taught,
Not too will use the simulation software,
//sent to 74 hs595
Void SendByte (unsigned char dat)//sent to 74 hs595
{
Unsigned char m;
For (m=0; m<8; M++)
{
SRCLK=0;
SER=dat& 0 x80.
Dat<=1;
SRCLK=1;
_nop_ ();
_nop_ ();
SRCLK=0;
}
RCLK=1;
_nop_ ();
_nop_ ();
RCLK=0;
}

A P1.0 port for equipment working state, the external pull resistance, low level has been switched on, switch to 74 hs595 output Q0, low level boot, high level shutdown,
Goal: in Q0, before starting the equipment has been circulation, until the P1.0 low level jump out of the cycle, perform follow-up program
Void System_booting_k (unsigned char a, unsigned char Y)//boot control
{
Unsigned char X;
While (a)
{
If (a==1)
{
X=(P2);
Y=0 x80;//1000 000
SendByte (X ^ Y);//xor P2 1 to 0, other unchanged,
Delay10ms ();
}
}
}

Void System_booting_k (unsigned char a, unsigned char Y)//boot control
{
Unsigned char X;
While (to a)
{
If (a==0)
{
X=~ (P2);//P2 incision value for the
Y=0 x80;//1000 000
Y=(X ^ Y);//xor P2 1 to 0, other unchanged,
SendByte (~ Y);//Y the output
Delay10ms ();
}
}
}

CodePudding user response:

That is behind the closed machine function, function name as the same, please ignore
  • Related