I was writing a driver for a graphics LCD for PIC 18F14K22. That went OK: ftp://panteltje.com/pub/graphics_lcd_driver_img_1_1861.jpg
But I wrote it is asm, so it needed a lot of typing, even more so because this display CD-19-HG1286418C has a strange driver chip S6B0108 that comes from a planet where x is vertical and y horizontal, and people write from to top to bottom probably on the right side towards the left... and the display uses 2 driver chips for each half... so it took a lot of key hitting: ftp://panteltje.com/pub/key_soup_img_1853.jpg to get it to do things the European way, that I then reversed with x0, y0 at bottom left as that is easier for what I want to do.
But now about the problem. I did all this with the 8 MHz PIC internal clock, and it works perfectly. Activated the internal 4 x PLL, so to 64 MHz internal clock, results in 16MHz processor clock.
Display stopped working, only display on and display off command still worked,. Well, added the usual delay between I/O operations, but this time, even with seconds delay, no effect. Finally grabbed the scope, and looked at the PIC pins. Now this is strange:
bsf PORTA,1 ; pin 18 LCD_C_D bcf PORTA,5 ; pin 2 LCD_WR
should set pin 18, and then clear pin 2
This is what happens at 16 MHz clock. But at 64 MHz clock after the first instruction pin 18 does not go high,
|||||||||||||||||||||||||||||||||||||| porta, 1 _________||||||||||||||||||||||||||||||||||||||_____________________ pin
18 16 MHz RF----------------------------------------------- | porta, 5 |_________________________ pin
2^ ^ | | bsf PORTA,1 bcf PORTA,5
but start outputting 16 MHz until the second instruction, and then goes to _zero_, the second instruction operates normally and clears pin 2.
It seems the PIC internal output FF for pin 18 does not toggle, but just follows the internal clock.
I suspected a load problem and added an emitter follower because it drives a 20 cm long flat cable to the LCD. pin 18 is also the PGC (program clock) for in circuit programming, but the effect persists with pin 18 loaded with with only about 1k to ground.
I think the PIC is out of spec here, but not sure if I am allowed to use it with
64 MHz on internal oscillator. Went back to 16 MHz clock, will work with that for now, will have to get some more PICs too to see if it is only this one.... FYI.