Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help me for lcd project

Status
Not open for further replies.
Simply delete some of the nonessential window dressing and output the current frequency value on line 2 instead of line 4.

LCD_D.h
Code:
void LCD_D()
{
	lcd_init();
	delay_ms(50);
	printf(lcd_putc,"*Frequency Counter*");
	lcd_gotoxy(1,[COLOR="#FF0000"]2[/COLOR]);
	lcd_putc("Frequency=");
}

freq counter.c
Code:
/*************************************/
/* Project: Frequency Counter        */
/* Copyright@ Abdullah M. Abdul-Hadi */
/* Date: 12-May-2011                 */
/* www.pic-tronics.com               */
/*************************************/

#include <16f877a.h>
#use delay(clock=20M)
#include <lcd420.c>
#include <LCD_D.h>
#fuses hs,nowdt,nocpd,nolvp,noprotect

#byte portc=0x07
#bit  led=portc.4

void LCD_D();

unsigned int16 value;

void main()
{
	set_tris_c(0x00);
	led=1;
	delay_ms(500);
	LCD_D();
	delay_ms(50);

	while(1)
	{
		set_timer1(0);	
		setup_timer_1(t1_external | T1_DIV_BY_1);

		delay_ms(1000);			// in protues, should be 1000/3
	
		setup_timer_1(T1_DISABLED);
		value=get_timer1();
		lcd_gotoxy(11,[COLOR="#FF0000"]2[/COLOR]);
		printf(lcd_putc,"%LU HZ   ",value);      
		led=!led;
	}
}

I do not believe LCD420.C has any dependency on the LCD display size, if you have any other issues check the routines in that file.

BigDog
 
The LCD connection is not correct for 4-bit LCD mode no matter how many lines it has, the data pins D0-D1-D2-D3 should be grounded.

Alex
 
thank's
i will try it......
 

I think it works in Proteus even if you leave the pins floating as shown in the schematic but the strange thing is that he has left them floating in the real hardware too , you can see in the first picture with the LCD connected to the breadboard that the data lines have no wire connected to them but the picture shows the display working!!!!!
In any case these shouldn't be left floating even if it may appear to work.

I was looking at the code and I wasn't able to find where he was writing the first and third lines and then I saw the code you have posted but I still wasn't able to find it until I noticed that it was referring to LCD_D.h

Why would anyone declare a function inside a header file?
I never thought of looking there...:roll:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
void LCD_D()
{
    lcd_init();
    delay_ms(50);
    printf(lcd_putc,"*Frequency Counter*");
    lcd_gotoxy(1,2);
    printf(lcd_putc,"Range (10-65535)HZ ");
    lcd_gotoxy(1,3);
    lcd_putc("********************");
    lcd_gotoxy(1,4);
    lcd_putc("Frequency=");
}



Alex
 

In any case these shouldn't be left floating even if it may appear to work.

I fully agree. As a general rule, learned from years of experience, I never leave any input pin floating even if specified as an option in the device's datasheet.

I was looking at the code and I wasn't able to find where he was writing the first and third lines and then I saw the code you have posted but I still wasn't able to find it until I noticed that it was referring to LCD_D.h

Why would anyone declare a function inside a header file?

Not the most optimal coding style, however it's not the worst I've seen.

I came across this gem the other day:

Code:
#include file.c

int main()
{
  ...
  ...
}

How is that for convoluted code? :roll:

BigDog
 

Can you please explain why the unused pins of lcd should be grounded. I have never done this before and my lcd display works.
 

You have to make sure that the Low state is forced to D0-D3 pins and that there is no possibility that a random High state can be encountered, this will ensure that there is no change of a wrong instruction.

Alex
 
if any one have a c compiler can help me by generate the hex file and but it in zip file
i sorry but a didn't have it
 

I think it is better to install your own, that way you will be able to make modifications in the code without asking every time someone else to compile the code.

Check this post https://www.edaboard.com/threads/223781/
The download link is **broken link removed**

Alex
 

The Microchip MPLAB installation includes the Hi-Tech C Pro Compiler for PIC10/12/16 MCU Families:

**broken link removed**

**broken link removed**

**broken link removed**

The project code above was written for the CCS PIC Compiler, so you will need to make some minor changes before compiling it with the Hi-Tech C Pro Compiler.

BigDog
 

Can you please explain why the unused pins of lcd should be grounded. I have never done this before and my lcd display works.

The following examines best policies and the reasons behind these policies when dealing with a devices unused pins:

What should I do with pins that I am not using?

Hope the info helps answer your questions concerning this issue,

BigDog
 

hey i really signing in microchip
and since yesterday a trying to down load it but i cant .... Access Denied .. i don't no why?
it did't work ...
 

hey
i still facing the problem and i need some one to generate the hex file for me ...
i have no time .. i must end my project today
....
 

hi
what this instruction means
unsiged int16 value?
led=!led;
 

unsigned int16 value declares a 16bit unsigned variable named value

"!" is the logical NOT operator so when you use !led then the resulting value will be 1 if led value is 0 or the resulting value will be 0 if the led variable has any non 0 value.

For example
!0x0 will result to 1
!0x1 will result to 0
!0x9 will result to 0
!0xF will result to 0

Alex
 

hi
i have problem with my pic16f877a .. it's stop working . i,m accidental power it in pin 20
what should i do??
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top