I am working on a project driving two DC Motors with PWM from feedback from hall encoders using 18f4331. Using hardware interrupt to read the encoder for one motor alone all works OK at all speeds with 20 Mhz. BUT when I add the second motor I loose the encoder count on both motors at high speed. So I have switched to 40 Mhz using 10Mhz crystal and config of OSC = HSPLL ;HS oscillator, PLL enabled (clock frequency = 4 x FOSC1). Seems that running the feedback drive profile I have is now working ok. BUT the LCD is a mess, it seems to display all the characters but in the wrong place. I have tried changing to 8 bit from 4 bit transmission the the 1602A LCD 2X16 and increasing the Baud rate but no luck, which makes debugging a bit tough!
Anyone had this issue or could held suggest a solution?
lcd mussed.jpg looks like this at 40 Mhz
lcd ok.jpgShould look like this 20 Mhz