Home > other >  Cc2530 microcontroller
Cc2530 microcontroller

Time:11-04

Why when I first button normal flashing, does not reflect the second button, or in the flashing, should not go out?
# include "ioCC2530. H"
# define uint unsigned int
# define uchar unsigned char
# define sw P1_2
# define d5 P1_3
Uint fp=0;

Void delay (uint time)
{
Uint I;
Uint j;
for(i=0; ifor(j=0; j<240; J++)
{
Asm (" NOP ");
Asm (" NOP ");
Asm (" NOP ");
}
}

Void init_vector ()
{
IEN2 |=0 x10.
P1IEN |=0 x04;
PICTL |=0 x02;
EA=1;
}

# pragma vector=P1INT_VECTOR
__interrupt void zhongduan (void)
{
If (P1IFG & amp; 0 x04)
{
If (fp==0)
{
Fp=1;
While (1)
{
Delay (1000);
D5=~ d5;
}
}
The else
{
D5=0;
Fp=0;
}
P1IFG & amp;=~ 0 x04;
}
P1IF=0;
}

Void main (void)
{
P1SEL & amp;=~ 0 x0c;
P1DIR & amp;=~ 0 x04;
P1DIR |=0 x08;
Init_vector ();
D5=0;
while(1);
}

CodePudding user response:

After the second button, the light is extinguished, but malicious fast will then flashes,
Interrupt handler has a
While (1)
{
Delay (1000);
D5=~ d5;
}
While (1) don't quit, have been flashing,
Define a variable record second button, on the while (1) determine the variable and then exit the while,

CodePudding user response:

reference 1/f, a tree may reply:
after the second button, the light is extinguished, but malicious fast will then flashes,
Interrupt handler has a
While (1)
{
Delay (1000);
D5=~ d5;
}
While (1) don't quit, have been flashing,
Define a variable record second button, on the while (1) determine the variable and then exit the while,

Can specifically what to write, just began to learn, I don't know how to write

CodePudding user response:

Specific writing has a problem
  • Related