We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi friends,i must have you help for this Cereous problum,
i have a code about a digital thermometer using the proc baord. I have compiled this code in microvision ide And the code is compiled and Built with some warnings and it works very Well.
The point is that i have built the circuit in time and it works perfectly.
the code isthis
int wait_1second ( void) delay { int delay_count ; delay_count = 100000; label: delay_count = --delay_count; if ( delay_count > 1 ) goto label; end_label: } }
I burn the proc whith the .hex generated and my LCD just show squares and charactors .
I have written the same code using other one and it works perfectly, i don't use assembler, thats the reason why i'm here asking for help. I put this circuit in files .asm & .hex for you to see.
Thanks in advance
If that's what you think, then you are seriously deluding yourself, I'm afraid!
A High-Level Language (HLL) such as 'C' gives you absolutely no guarantee whatsoever as to how long any particular set of source statements will take to execute - but your wait_1second functions relies completely upon it!
Therefore, your program is only working by pure luck - it might take just one, small, apparently unrelated change to break it completely!
As has already been said, do not use 'C' software loops for timing delays! For short delays, it might be OK to use an assembler delay loop; For delays on the order of a second, you should almost certainly be using a hardware Timer.
See: www.8052.com/.../read.phtml