that last line was wrong should be


day = ((reg_val[3] >> 4) * 10) + (reg_val[3]$0f) ; bcd2bin conversion

lcdout dec2 day

must have been too early in the morning for me