My C is a bit rusty, but I gather that GPIO is 8 bits, so yOu would most likely have to typecast a char into a 8 bit integer.
So, assuming GPIO is an 8 bit integer and GPIO.bit 0 is the lowest order bit then:
GPIO = (GPIO .and. NOT 15) .OR. BCDVALUE, that's if you want to preserve the contents of bits 4 & 5
Reading the port and ANDING with 15 will clear the low order bits. ORing it with the BCD value will set them.
So suppose the port is 16+32+1 or 00110001 binary. The data sheet seems to say that the upper two bits get read as a zero.
Make BCD Value =6 or 1010
00110001 ; present value of port
11110000 = NOT 15 ; bits of interest
00110000 AND the values; clear the bits of interest
00001010 the value 6; The desired value of the low order bits
00111010 OR the two values; The first line with the 4 lower bits changed
I'm not using valid C constructs.
There is some interesting stuff here:
https://www.electro-tech-online.com/custompdfs/2012/08/Microchip20C1820Compiler20Use.pdf
The point is to type cast into an unsigned char and how to set/clear bits.