|
|
View previous topic :: View next topic |
Author |
Message |
Zulhafiz
Joined: 11 Apr 2013 Posts: 2 Location: Cyberjaya, Malaysia
|
No output shows in LCD for PIC18F8722 |
Posted: Thu Apr 11, 2013 1:45 am |
|
|
Hi guys... I am beginner in CCS Programming and PIC18F8722 and C Programming...
I have Everboard Development Kit for PIC18F8722 and I need to design ADC in which can shows the output LCD.
I read in CCS forum and found flex_lcd.c file. I try modified that code to suit any available pin in that PIC development kit which connect to LCD 16x2.
The available pin in that development kit is A1, A2, B0, B1, B2, C0, C1, C2, C3, C4, C5, F1, F2, F3, F4, F5, F6, F7, G0, G3, H4, H5, H6, H7, J4, J5, J7 and J6.
My problem is, the output of the LCD shows nothing. My mind is stuck right now since last 3 weeks just thinking to solve this problem.
Anyone experts can help me..??
This is code for flex_lcd.c which already post by others:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
Code: | // flex_lcd.c
// These pins are for the Microchip PicDem2-Plus board,
// which is what I used to test the driver. Change these
// pins to fit your own board.
#define LCD_DB4 PIN_F0
#define LCD_DB5 PIN_F1
#define LCD_DB6 PIN_F2
#define LCD_DB7 PIN_F3
#define LCD_RS PIN_F4
#define LCD_RW PIN_F5
#define LCD_E PIN_F6
// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.
//#define USE_LCD_RW 1
|
Main Programme, LCD_Test.c:
Code: | #include <18f8722.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP,
#use delay(clock = 20000000)
#include "flex_lcd.c"
//============================
void main()
{
lcd_init(); // Initialize the LCD
lcd_putc("\fHello World\n");
lcd_putc("Line Number 2");
while(1);
} |
I don't now what to do. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Apr 11, 2013 4:16 am |
|
|
ALWAYS: post your compiler version.
Can you post a link to more information about your hardware? When I search for Everboard I can't find it.
always start a new project with the most simple program you can think of: a blinking LED. This confirms many parts of your hardware are working and running at the correct frequency.
Your current setup will fail to run the blinking LED program.
What is your clock frequency? You specified 20MHz, but that is wrong for the XT fuse setting. So: use XT fuse and maximum of 4MHz, or use HS fuse for frequencies 4MHz to 25MHz. |
|
|
Zulhafiz
Joined: 11 Apr 2013 Posts: 2 Location: Cyberjaya, Malaysia
|
|
Posted: Thu Apr 11, 2013 8:58 pm |
|
|
Hi Ckielstra.. Thanks a lot for reply..
I use CCS PCWHD Compiler version v4.130.
Actually there are no information of this kit. This kit just use for learning purpose. It use PIC18F8722 as main chip.
here is link to the photo of this Development kit:
Also schematic picture for this board:
As you stated, I actually already do Programming to light the LED which already build in that kit. I also success do a programming which counting decimal 1 to 99 using dual 7 segment.
Here is C program to light the Green LED which is already connect to Pin RA5 in PIC18F8722.
Code: | #include <18f8722.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)
#define GREEN_LED PIN_A5
void main(){
while (TRUE){
output_low (GREEN_LED);
delay_ms (1000);
output_high (GREEN_LED);
delay_ms (1000);
}
} |
For the counting decimal 1 to 99, here is the code:
Code: | #include <18f8722.h>
#fuses HS,NOLVP,NOWDT
#use delay(clock=20000000)
#define GREEN_LED PIN_A5
#define YELLOW_LED PIN_B4
#define RED_LED PIN_B5
byte CONST LED_MAP[10] =
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
void display_number( int n) {
output_f(LED_MAP[n/10]);
output_low(PIN_C0);
delay_ms(4);
output_high(PIN_C0);
output_f(LED_MAP[n%10]);
output_low(PIN_C1);
delay_ms(4);
output_high(PIN_C1);
}
void main() {
int count=1,i;
while(TRUE) {
for(i=0;i<=200;i++)
display_number(count);
count = (count==99) ? 1 : count+1;
}
} |
Also, this is the link for the connection for Dual 7 Segment to PIC18F8722 Pin.
In this Kit, it is already use 20MHz Xtal.
Is anybody experts with PIC can give any suggestion about coding for ADC with LCD .
I cannot solve it my own... So sad... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Fri Apr 12, 2013 3:43 am |
|
|
Serious comment 1. Your connections for the LED, risk damaging the chip. No current limiting resistors. The chip will be overheating, and could damage the port pins you use.
Now, the way to work, is slowly. Think about the connections:
1) Have you got the R/W pin on the LCD connected to ground?.
2) Is the ground and the power supply connected to the LCD?.
3) What have you got connected to Vee on the LCD?.
I suspect the latter is the problem.
LCD's require a contrast control voltage. without this connected, they generally display nothing. Some modern LCD's allow this to be connected to GND, and work. However most LCD's require a small voltage of about 0.4v on this pin. Hence it is common to use a pot to feed this. Some LCD's require a -ve voltage here. You need to get this right.
4) Triple check the data connection to the LCD. Remember it is D4 to D7 that are used, not D0 to D3. It is a fairly common error to get these wrong.
5) Add smoothing close to the LCD.
Best Wishes |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Fri Apr 12, 2013 5:51 am |
|
|
general comment..
Buy a roll of 10 conductor, 22 ga, solid wire. It'll have all 10 colours ! Makes wiring breadboards a lot easier. Having just 1 colour (white in your case) very easy to miswire 1 or 2 connections...
Even some 'telephone' cable is better (4 colours,R,G,B,Y).
hth
jay |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|