Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/09/03 21:59
Read: times


 
#56444 - RE: break sequence
Responding to: ???'s previous message
This is all my code, im initializing the p3_x as 1 so they act as inputs but the sequence i wrote is supposed to blink and but instead it changes from P1=~0xFF to P1=~0x66.

I dont haver much experience with microcontrollers and i dont remember much of c programming so maybe theres a better way to do this.

======================================================

#include <at89x52.h>

void delay(unsigned del)
{
unsigned i,j;
for(i = 1; i<del;i++)
for(j = 0; j<185;j++);
}


void main(void)
{
unsigned char i=0;
unsigned char tled1[12]={0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00};
unsigned char tled2[12]={0x66,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x66,0x00};
P3_2=1;
P3_3=1;
while(1)
{
while(P3_2==1);
delay(50); //delay to debounce
for(i=0;i<12;i++)
{
P1=~tled1[i];
delay(75); //flashing sequence
if(P3_3==1) //exit to other sequence
break;
}

while(P3_3==1);
for(i=0;i<12;i++)
{
P1=~tled2[i];
delay(75); //flashing sequence
if(P3_2==1) //exit to other sequence
break;
}
}

List of 9 messages in thread
TopicAuthorDate
break sequence            01/01/70 00:00      
   RE: break sequence            01/01/70 00:00      
   RE: break sequence            01/01/70 00:00      
   RE: break sequence            01/01/70 00:00      
   RE: break sequence            01/01/70 00:00      
   RE: break sequence            01/01/70 00:00      
   RE: Better Approach            01/01/70 00:00      
      RE: Better Approach            01/01/70 00:00      
         RE: Better Approach            01/01/70 00:00      

Back to Subject List