Home > other >  Implementation cycle of 200 ms, respectively 500 ms, and 1 s pulse signal, control eight light conve
Implementation cycle of 200 ms, respectively 500 ms, and 1 s pulse signal, control eight light conve

Time:12-06

C language implementation cycle of 200 ms respectively, 500 ms, and 1 s pulse signal, control of eight light transformation, please do me a favor, thank you

CodePudding user response:

Get a 1 ms timer, timer interrupt
Set three variables A, B, C

Each interrupt
+, B++, c + +;
If (A==200)
{
A=0;
Pa=~ Pa;//a pin flip
}
If (A==500)
{
B=0;
Pb=~ Pb;//a pin flip
}
If (C==1000)
{
C=0;
Pc=~ Pc;//a pin flip
}

CodePudding user response:

Single-chip microcomputer timer interrupt
  • Related