Hello. I've got some special LED displays.
These are tiny 7 segment matrices, used in powerbanks and so on.
The key difference is that leds there are plugged into forward-reverse matrix, so you need to multiplex them to get meaningful results.
So in theory, operation is as follows:
1. Set all ports to high impedance state.
2. Pull high one port, pull down another port, so led connected thru it will be lit
repeat above with different ports in loop, to get the things needed.

The main issue is that either TRIS statements does not work, or HIGH-LOW statements interfere with them. In practice, this means that when I issue HIGH PORTB.3 or any other similar statement, some other PORTB pins also change their state. Adding TRIS.X=1 or 0 changes nothing. How to avoid this?
led segments are connected to PIC pins via 220 ohm resistors.

MCU is PIC16F886 and this is the sample code.

Code:

TRISA=%00000000  'S
TRISC=%00000000   'set
TRISB=%00000000   '
ANSELH=%00000000   ' ADC OFF B
ANSEL=%000000000 'configure PortA as digital except first 2
ADCON1=%10000000  'adc justify
OSCCON=%01110101  'SET FREQUENCY TO 8MHZ
WPUB=%00000000    'turn off Pullups
CM1CON0=0         'DISABLE COMPARATORS
CM2CON0=0         'SAME HERE


DEFINE OSC 8 'set oscillator speed  


'adcin config
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50




frak:
high porta.6
low portc.3
pause 2
low porta.6
high portc.3
pause 2
'
high portc.1
low portc.2
pause 2
low portc.1
high portc.2
pause 2


goto frak
stop