1

Using MikroC Pro for PIC16f73 to multiplexing 7 segment the written program is:

PORTB = Hex (x%10);

There PORTB means RB0 to RB7 total 8 pins are includes, but I want to use only 7 pins for 7 segments RB0 to RB6, and the pin RB7 as other O/P just 0 or 1.

As like Rb0 to Rb6 = hex (x%10) and Rb7_bit = 0 or 1

so how to define the line Rb0 to Rb6 = hex (x%10);

Mike
  • 4,041
  • 6
  • 20
  • 37
Omar
  • 11
  • 2

1 Answers1

0

Try this:

uint8_t   Pin_Value;

Pin_Value = Hex (x%10);
Pin_Value |= 0x80;       //set bit RB7
Pin_Value &= 0x7F;       //clear bit RB7
PORTB     = Pin_Value;
Mike
  • 4,041
  • 6
  • 20
  • 37