# Arduino Mega2560 and Reversed output on 74hc595

I was trying to light up 2 7-segment display using a 74hc595. I’m using common anodes 7-segment, so basically when i want to light up the segment i need to give low logic output to 74hc595… but i faced a very unexpected result. i can’t light up the segment with Low logic… but when i use a High logic the segment is light up… is this make sense?
if i give HIGH into the shift register output, i have +V at both ends of my circuit, and no current flows. is the 74hc595 inverting the logic that i give?

this is the schematic

//This is the hex value of each number stored in an array by index num [G,F,E,D,C,B,A], [0,1,2,3,4,5,6,7,8,9]
byte digitOne[10]= {0b10111111, 0b00000110, 0b11011011, 0b11001111, 0b11100110, 0b11101101, 0b11111101, 0b00000111, 0b11111111, 0b11101111,};
byte digitTwo[10]= {0b10111111, 0b00000110, 0b11011011, 0b11001111, 0b11100110, 0b11101101, 0b11111101, 0b00000111, 0b11111111, 0b11101111,};

digitalWrite(LATCH, LOW);
shiftOut(DATA, CLK, MSBFIRST, ~digitTwo*); // digitTwo*
shiftOut(DATA, CLK, MSBFIRST, ~digitOne[j]); // digitOne
digitalWrite(LATCH, HIGH);

Have you checked that the 7-segment really is common anode?

Have you checked the HC595 really is a HC595?

Yes, I would build the digit tables with positive logic. i.e. bit is 1 for lit segment.
Then XOR with 0xff for common anode. XOR with 0x00 for common cathode.

You are using the ~ operator. This is the same as XOR all bits i.e. 0xff.

David.

yes i checked it manually, i give the power positive + to anode.. and give the ground to each segment and it working fine.
yes it's 74hc95.. Sn74hc595 precisely..
so the problem is not on my schemataic but on my code right?

( ~ )that code has XOR all my bits with 0xff.? sorry i'm still new to arduino..

Thank you david.. i tried to change it (~), and it works fine now, i guess i need to learn about Bitwise Operators for now..