Why do you think you need to use direct port manipulation for something as slow as an infrared sensor?
The code does something. We can not see what it actually does.
You expect the code to do something. You seem to have forgotten to mention what you expect it to do.
"but they don't interface with each other" looks like a random collection of words. It conveys no useful information.