LCD Interaction with PIC16f676

Post
baseball07
Starting Member
2011/08/09 13:34:01
Hey everyone, 

I'm programming a PIC16f676 to work with a CFAH0802D-YYH-JP LCD. I've already checked the code on the BT_Out pin without any of the LCD code and have verified that the frequency counter in the code does indeed work. The issue is when connected to the LCD screen, the initialization of the LCD fails (a row of black squares is displayed).  I'm new to working with microprocessor to LCD in assembly so any help or suggestions is appreciated



griswold
New Member
Re:LCD Interaction with PIC16f676 2011/08/09 15:01:46
By "frequency counter" do you mean that you've vetted all of your timing routines with a scope? your 5mS is really 5mS, in other words.

I can't help with LCD specifics for that model, but the one I've been using is pretty sensitive to timing.

Hope this helps,
John

dan1138
Super Member
Re:LCD Interaction with PIC16f676 2011/08/09 19:03:11
baseball07

I'm programming a PIC16f676 to work with a CFAH0802D-YYH-JP LCD.
 
I've already checked the code on the BT_Out pin without any of the LCD code and have verified that the frequency counter in the code does indeed work.
 
The issue is when connected to the LCD screen, the initialization of the LCD fails (a row of black squares is displayed).  
 
I'm new to working with microprocessor to LCD in assembly so any help or suggestions is appreciated

I have looked at your code and find that what your have said in your second sentence is false.
Your claim is that you checked the BT_Out pin that your code has assigned to RA3.
On the PIC16F676 RA3 is an input only pin. Where BT_Out may be it is not on RA3.
 
The code you have for LCD output look just wrong to me. It's too hard to spot any but the obvious issues.
Your LCD initialization routine uses a CLRF PORTA statement.
This is a bug because not all of the output bits of PORTA are used exclusively by the LCD.
 
There are other issues in your LCD code that are not exactly bugs but will limit what you can use PORTC bits RC4 and RC5 for.
 
You method for counting the edges of the input frequency is lame and would be much better if one of the TIMER/COUNTERS in this PIC was used as an event counter.
 
Your interrupt service routine calls functions that can take a long time to complete. Again this is not a bug, but it is a bad thing to do in an interrupt service routine.
 
I understand that you are new to all this, but your code needs a lot of improvement.
 
 
nodrog2469
Starting Member
Re:LCD Interaction with PIC16f676 2011/08/16 02:56:18
Apart from correcting your code, and on a practical level: If you are using a PicKit 2 to program, you need to set the MCLR line high. I have found that, with a few LCD's, the MCLR line realy needs isolating, (on a switch), for reliable running. On occasion, even removing the PicKit 2 has not worked until MCLR is isolated.
Hope this helps,
RGR
wa1vgb
Super Member
Re:LCD Interaction with PIC16f676 2011/08/16 16:46:27
I notice your interupt routine restores the status and W register and then keeps on processing some commands before the retfie.  You will need to change that around.  Those banksel commands are changing your status register, other commands may be setting Z flag and so forth.

I suggest taking the LCD routines out into a minimal program and get those to work and then add them to the freq counter code.