void UpdateMenu(void){
unsigned char leftL, leftH, topV,x;
/*
char left = 104; //88 + 18 = 104 //I add 18 becuase the LCD starts on pixel 18 not 1
leftH = left >> 4; //Calculate The Left Pixel
leftH |= 0x10; //Get upper byte in LeftH OR with 0x10 to prodcuce a valid command
leftL = left & 0x0F; //Get lower byte in LeftL
// Older Code remove with next 2 lines
*/
leftH = 22; //Since this is a constant value i did the math
leftL = 8; //to save some time and placed it here
topV = 0xB0 + Top_POS; //Get the Top position and add 0xB0 to set the row (TOP)
if(Menu_POS > 3) { //If in Item 4 aka 0 erase arrow on 3
LCD_Send((topV-1),0); //Send Top Position - 1 this way we get the arrow on 3
LCD_Send(leftH,0); //Send Upper Left Position
LCD_Send(leftL,0); //Send Lower Left Position
for(x=0;x<8;x++) //Clear the arrow by setting to all 0's
LCD_Send(0x00,1);
Menu_POS = 0; //Clear the Menu Position
Top_POS = Top_STA; //Reset the Top Start
}
if(Menu_POS > 0){ //If item is greater than 0 do below
if(Menu_POS > 1){ //If in Item 2 erase arrow on 1 or 3 erase arrow on 2
LCD_Send((topV-1),0); //Send Top Position
LCD_Send(leftH,0); //Send Upper Left Position
LCD_Send(leftL,0); //Send Lower Left Position
for(x=0;x<8;x++) //clear the old arrow
LCD_Send(0x00,1);
}
LCD_Send(topV,0); //Send New Top Position
LCD_Send(leftH,0); //Send Upper Left Position
LCD_Send(leftL,0); //Send Lower Left Position
for(x=0;x<8;x++) //Send out our arrow which is added to the FontA and FontB
LCD_Send(FontB[96][x],1);
}
switch(Menu_POS){ //This is the actual command to set the LEDs
case 0:
LATB = 0b00000111; //Common Anode so to turn on i need Logic Low to turn on led.
break;
case 1:
LATB = 0b00000110;
break;
case 2:
LATB = 0b00000101;
break;
case 3:
LATB = 0b00000011;
break;
}
}