I am building a Voltmeter for a PIC18F using an XC8 compiler on MPLAB and I am having trouble getting my second digit value to update as I rotate my potentiometer. A potentiometer is connected to PORTA, the two digit seven segment display is connected to two 74LS47 decoders. and those two decoders are connected to PORTS B0-B7. PORT B0-B3 is attached to the first decoder, and B4-B7 the second decoder which drives the second digit of the display. When I rotate the potentiometer, the first digit changes accordingly, but the second digit just stays at zero. I've tried multiplying the voltage by 10 then using mod(%) to extract the second digit value, but it seems the compiler doesn't use %. I have tried using a work around to mod(in the code below) to see if it would work and nothing has so far. Also, I've tested the second digit by outputting "firstdig" to PORTS B4-B7 to make sure my circuit is built correctly and it was. Any guidance or suggestions would be greatly appreciated. I've been stuck on this for quite a while.
int VREF = 5;
float VOLTS = ((num*VREF)/1024);
int firstdig = floor(VOLTS);
int seconddig = floor(VOLTS * 10) - (firstdig * 10);
int LSB = firstdig;
int MSB = seconddig;
MSB = MSB<<4;
PORTB = LSB | MSB;
__delay_ms(50); ```