# need help for the small project

Status
Not open for further replies.

#### hasnain2512

##### Newbie level 4
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

• 83.6 KB Views: 7
Last edited by a moderator:

#### tpetar

Did you try on protoboard with real parts?

#### bigdogguru

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

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