I am using NEX Robotics board for LPC2148. I find very strange problem with below lines of code.
//Prototypes void diaplayInRow1WithPosition(unsigned char* data, unsigned char position); void diaplayInRow2WithPosition(unsigned char* data, unsigned char position); unsigned char convertHigherNibbleToASCIIValue(unsigned char data); unsigned char convertLowerNibbleToASCIIValue(unsigned char data); int main (void) { unsigned char temp2; unsigned int PLLStatus; initializeAll(); PLLStatus = PLL0STAT; temp2 = convertLowerNibbleToASCIIValue(PLLStatus); diaplayInRow1WithPosition(&temp2,15); temp2 = convertHigherNibbleToASCIIValue(PLLStatus); diaplayInRow1WithPosition(&temp2,14); temp2 = PLLStatus>>8; temp2 = convertLowerNibbleToASCIIValue(PLLStatus); diaplayInRow1WithPosition(&temp2,13); return(0); } When this code is executed, I see a blank display. I noticed that the problem is with last convertLowerNibbleToASCIIValue function call. It should have been:
temp2 = convertLowerNibbleToASCIIValue(temp2 ); But because of this one line error, why entire display is blank? Only last function diaplayInRow1WithPosition should have given trouble right? Even after changing with above line, I am getting blank display. So I replaced that line containing last convertLowerNibbleToASCIIValue as
temp2 = convertLowerNibbleToASCIIValue(PLLStatus>>8); And finally I got correct display.
Unable to digest the problem. Anyone can help? Main answer I need is if at all there is a problem in one line, why previous lines are not getting executed correctly? I am using Keil compiler and any compiler dependencies? There is no compilation error. If there is a problem with types etc, will entire program get corrupted? Also I noticed that adding extra dummy line such as temp=10; changes the behavior even though temp variable is not utilized.
Thanks for feedback on posting the code. Yeah, I did not notice
and <\pre>. I tried removing return from main. Even then behavior is not consistent.
Exiting main(), yes bad idea there, where do you think that goes?
int main(void) { //....your code while(1); //infinite loop for not existing main }