Perhaps you're right. Maybe I did. Maybe I just couldn't find it. 
Here is the code, both old and new, with changes in font and highlight added in 
my email. If you could spare a little time, please tell me where, because I am 
just not able to get it. Neither did the compiler. I'll be happy to widen my 
"experience level" :-)The program wasn't even returning to the calling function 
after this first (highlighted) line, nor was it going to the last line, nor any 
line after the (first highlighted) line. Anything before this (first 
highlighted) line was reached, ran perfectly, whether lcd calls, or port bit 
toggles, whatever.
Thank you for your support and time.
char volatile  ticks;char volatile  ticker;char volatile  ticker5;char volatile 
 ticker15;char volatile  ticker8;

void keypress(void)//This routine only meant for bfan. checks which key 
pressed, lights that led, and returns giving the value in keyval{ keyval=0; 
itix=ticker15; SLCD_Position(0,8); while(itix==ticker15) {THIS IS THE NEW CODE. 
All lines run without any issues. if((PC_IDR & upkey)==0) { SLCD_PrChar('A'); 
tixnow=ticks; while(tixnow==ticks); SLCD_PrChar('B'); if((PC_IDR & upkey)==0) 
//confirmed keypress { SLCD_PrChar('C'); PC_ODR |= (1 << LU_PIN); //Set LU ON 
while(!(PC_IDR & upkey)); //wait till key released keyval=upval; PC_ODR &= ~(1 
<< LU_PIN); //Set LU OFF SLCD_PrChar('D'); return; } }/*  if((PC_IDR & 
dnkey)==0) { SLCD_PrChar('E'); tixnow=ticks; while(tixnow==ticks); 
SLCD_PrChar('F'); if((PC_IDR & dnkey)==0) //confirmed keypress { 
SLCD_PrChar('G'); PC_ODR |= (1 << LD_PIN); //Set LU ON while(!(PC_IDR & 
upkey)); //wait till key released keyval=dnval; PC_ODR &= ~(1 << LD_PIN); //Set 
LU OFF SLCD_PrChar('H'); itix=ticker15; } } *//*  if((PC_IDR & okkey)==0)
 { SLCD_PrChar('I'); tixnow=ticks; while(tixnow==ticks); SLCD_PrChar('J'); 
if((PC_IDR & okkey)==0) //confirmed keypress { SLCD_PrChar('K'); PC_ODR |= (1 
<< LO_PIN); //Set LU ON while(!(PC_IDR & okkey)); //wait till key released 
keyval=okval; PC_ODR &= ~(1 << LO_PIN); //Set LU OFF SLCD_PrChar('L'); 
itix=ticker15; } } */  } keyval=noval;}THIS onwards is the old NOT WORKING 
code. 
/*  if((PC_IDR & upkey)==0) //(1 << UPKey_Pin))==0) {  //wait for tick delay to 
confirm key press, SLCD_PrChar('C'); tixnow=ticks; while(tixnow==ticks); 
if((PC_IDR & (1 << UPKey_Pin))==0) {  SLCD_PrString(str11); PC_ODR |= (1 << 
LU_PIN); //set LU ON while(!(PC_IDR & (1 << UPKey_Pin))); //wait till key 
released keyval=upval; PC_ODR &= ~(1 << LU_PIN); //set LU OFF return; } } 
if((PC_IDR &= (1 << DnKey_Pin))==0) {  //wait for tick delay to confirm key 
press, tixnow=ticks; while(tixnow==ticks); if((PC_IDR & (1 << DnKey_Pin))==0) { 
 PC_ODR |= (1 << LD_PIN); //set LU ON while(!(PC_IDR & (1 << DnKey_Pin))); 
//wait till key released keyval=dnval; PC_ODR &= ~(1 << LD_PIN); //set LU OFF 
return; } } if((PC_IDR & (1 << OKKey_Pin))==0) {  //wait for tick delay to 
confirm key press, tixnow=ticks; while(tixnow==ticks); if((PC_IDR & (1 << 
OKKey_Pin))==0) {  PC_ODR |= (1 << LO_PIN); //set LU ON while(!(PC_IDR &= (1 << 
OKKey_Pin))); //wait till key released keyval=okval; PC_ODR &= ~(1 << LO_PIN); 
//set LU OFF return; } } } keyval=noval; }*/

Thanks and Warm Regards
Shiv




    On Friday, October 25, 2019, 12:43:53 AM GMT+5:30, Philipp Klaus Krause 
<p...@spth.de> wrote:  
 
 Am 24.10.19 um 16:02 schrieb Shivakumar R via Sdcc-user:
> Hi Philipp
> 
> My Problem is no more! :-)
> 
> I am using Notepad++ as my code editor, and compiling and running
> 'packihx' in a Dosbox. My pcb is a custom one that has been running
> since about a month.
> I had checked, rechecked and re-re-re-re-re checked the source, list
> file and hex file in Notepad++ as well as in STVP, and could not find
> any probable cause or bug or wrong mnemonic or wrong instruction in any
> file, whether source, or lst or hex. 
> Frustrated, and finding no other way out, I simply rewrote ( no copy
> pasted) the c function (keypress) in the c source file in exactly the
> same way it was in the original. Using Notepad++ again. Saved, Compiled
> and packihx in my dosbox. Programmed the same card with STVP. 
> It worked like a charm. No other change required. At all.
> I still haven't found out the cause of the problem, but the program now
> works completely. 

This sounds a lot as if you did add an extra semicolon somewhere it
wasn't meant to go when you typed the program the first time.

Philipp
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user
  
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to