The Elektor Forum will close. See also this link. From Friday March 1st it is no longer possible to log in to the forum. However, the content of the forum will remain visible until the end of March. As of April 1st the forum will definitely go off the air.

wait loop

An Elektor Distance Learning Course

Postby dirk_999 » Mon Apr 09, 2012 12:00 am

I plug the switch bord on portB.
I plug the led bord on portC.

I press switch B0 and I'm holding it down the entire time.

I download the following program in the µC.

trisb=0b11111111;
trisc=0b00000000;
portc=0b00000000;
delay_s(2);
while(portb&0b00000001); //waiting loop
portc=0b00000001;
while(1);

After 2 seconds the led C0 goes on. What is the reason for this?
I hoped that the led C0 would light up but only when I let the button B0 go.

Thanks in advance for your help
dirk_999
 
Posts: 11
Joined: Thu Jan 02, 2014 10:49 am

Postby geenbert » Tue Apr 10, 2012 12:00 am

Did you connect the switchboard to the power?
geenbert
 
Posts: 83
Joined: Thu Jan 02, 2014 10:41 am

Postby dirk_999 » Tue Apr 10, 2012 12:00 am

thanks that was my stupid fault
dirk_999
 
Posts: 11
Joined: Thu Jan 02, 2014 10:49 am

Postby geenbert » Tue Apr 10, 2012 12:00 am

Glad to hear that this solved your problem. Enjoy the course.
geenbert
 
Posts: 83
Joined: Thu Jan 02, 2014 10:41 am


Return to Programming Embedded PIC Microcontrollers using Assembly, C and Flowcode

Who is online

Users browsing this forum: No registered users and 1 guest