??? 06/16/04 06:32 Read: times |
#72560 - Static Local Variable Vs Global Variable |
Hello All,
I am quite new to C programming for microcontrollers. As I can make out, there is a big difference in writing a program in Turbo C and writing a program for 8051 or any other microcontroller, as the Memory is the main constrain. I have a small doubt about static local variable & global variable. I ahve made a surch on 8052 for "Static local Variables" and found many results but somehow they confused me more :-( the links are http://www.8052.com/forum/read.phtml?id=34575 http://www.8052.com/forum/read.phtml?id=33249 http://www.8052.com/forum/read.phtml?id=33225 http://www.8052.com/forum/read.phtml?id=9800 http://www.8052.com/forum/read.phtml?id=8228 I have a function in which I check for a certain error condition and if that error is there for 7 consicutive cycles then only I acknowledge it as an error for my system. Here for counting the consicutive occurences of the error I am using a counter variable (fail_count) and I am incrementing it whenever I get an error cycle. In my system of controlling a fuel flow I have to control many things ( The system consists of -- Control Board -- AT89C52 Based main controller Board Display Boards -- 16+16 - 1" LCD digits driven by using 7211 Display Driver Keyboard -- 20Key Keyboard Keypad Display -- 20 Charactor LCD with Backlight Optical Pulser -- 3 Optical sensors Relay Board -- 2 Solenoid relays and 1 main motor relay ) As much as I can makeout both static local as well as global will solve my problem of having a counter for counting number of error-cycles only But please tell me what will be benifitail - If I make the variable fail_count as static local variable or as global variable. I am using a KEIL PK51 tool & I would like to know the possibilities of the global variable's value getting altered, which is not expected. I think, I am confused totally, please help. Sachin |
Topic | Author | Date |
Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
Not 8051-Specific | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable | 01/01/70 00:00 | |
RE: Static Local Variable Vs Global Variable![]() | 01/01/70 00:00 |