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.

need help for the small project

Status
Not open for further replies.

hasnain2512

Newbie level 4
Joined
May 4, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
hey every one i write the code for frequency meter using atmega 16 in compiler code has no error but when i checked in proteous nothing show on LCD

the Zip archive for code + proteous file use avr GCC compiler is attached.
 

Attachments

  • tes21.zip
    83.6 KB · Views: 56
Last edited by a moderator:

One possible issue maybe, you may need to specify a clock frequency in the device properties dialog box rather than the default which according to Proteus docs is 1MHz.



Although, I maybe incorrect as I've never simulated an AVR design in Proteus.

I stand corrected, after conferring with Alex, apparently if the an Internal RC (1/2/4/8MHz) is selected the clock frequency entry is simply ignored.



Another possible issue maybe, your LCD initialization routine does not appear to provide adequate delays after each initialization command has been issued and the power on delay is much too short (2ms), I usually recommend a 50ms delay as it is sufficient for most applications.

Code:
	void lcd_init()
	{
		LCD_CPRT = 0xFF;
		LCD_DPRT = 0xFF;
		LCD_CPRT &= ~ (1<<LCD_EN);
		_delay_us(2000);
		lcdcommand(0x38);
		lcdcommand(0x0E);
		lcdcommand(0x01);
		_delay_us(2000);
		lcdcommand(0x06);
	}




BigDog
 
Last edited:

Variable i is used in both main and interrupt handler but is not volatile.

Also the EN pin is defined in the wrong pin (bit 3 instead of bit 2)

#define LCD_EN 3

- - - Updated - - -

You initialize your LCD at the start of main and also inside the while loop (which will be executed ,multiple times)

- - - Updated - - -

Maybe consider using an LCD library like (or any other).
When the rest of your code works as intended then you can make your own library too but having several things that can be wrong at the same time is a recipe for disaster.
 

thanks for ur reply i tired ever thing but not work for me why ?
 

If you don't want to use a ready LCD library then create a new project a try to make your own but only try to show a simple message.
When you manage to do that the you can experiment with the timers and what you are trying to do.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top