Driving LCD using PIC18LF27K42
I am too new here to post a comment. What I can do is post an answer.

This link is to my Github repository that is an MPLABX project using the XC8 compiler to custom craft a demo application to your specifications.

I do not have a PIC18LF27K42 to test it on in real hardware.

Perhaps it can work for you, please give it a try and let me know.