I know that for programmers of normal code, while(1) is anathema, and always avoid and never used.
on the other hand for programmers of embedded systems it is almost always used in the following sense:
It allows the system to "run forever" so as to permit that the embedded firmware wont stop
However, I am being faced with a third option. I am (trying to ) maintaining some code I ve been handled and I found while(1) inside the code initialization function.
For example:
Now, for what I see there is some LED flashing done and then an infinite loop of a Buzzer sounding!!!Code:PD.PDR.Reg=0x80;/* Output setting*/ PD.PCR.Reg=0x6AAA;/* PD 7 Out 0-6 In */ PJ.PDR.Reg=0xE0;/* Output setting */ PJ.PCR.Reg=0x56AA;/* PJ 5-7 Out 0-4 In */ PJ.PDR.BIT.P5DT =0;/* LED flashing */ PJ.PDR.BIT.P6DT =0; PJ.PDR.BIT.P7DT =0; while(1){ PD.PDR.BIT.P7DT =0;/* Buzzer */ }
Something obviously have to change because this code when executed is not buzzing for ever. Any idea what can make the code advance? At first I thought interruptions but interruptions would make me return to the same point I was interrupted right?
Even Crazy, or any ideas welcome to understand what is going on