Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

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

Last edited by a moderator:

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,348
Reputation
4,690
Reaction score
2,273
Trophy points
1,413
Location
Southwest, USA
Activity points
62,487
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:

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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 http://homepage.hispeed.ch/peterfleury/avr-software.html#libs (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.
 

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
thanks for ur reply i tired ever thing but not work for me why ?
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top