السلام عليكم

لقد كتبت هذا البرنامج لكتابة احرف على شاشة lcd بلغة السي و حاولت محاكاته على بروتيوس و لكنه لا يعمل الشاشة تضيئ فقظ اذا امكن مراجعته فانا لا اعرف هل المشكلة في البرنامج ام البروتيوس . استعمل atmega 32 وبرنامج avr
و شكراً
كود:
#define LightSwitch 5
#define ReadWrite 7
#define BiPolarMood 2
#include <avr/io.h>
#include <util/delay.h>
void CheckIfBusy(){
DDRB=0X00;
PORTD &= ~(1<<2);
PORTD |= (1<<7);
while (PORTB >=0X80)
{
BlinkLght();
}
DDRB=0xFF;
}
void BlinkLght(){
PORTD |= (1<<5); //Turn Enable on so Mr. LCD can function
asm volatile ("nop");
asm volatile ("nop");
PORTD &= ~(1<<5); //turn off Enable so Mr. LCD can Concentrate
}
void SendCommand (unsigned char command)
{
CheckIfBusy();
DDRB = command;
DDRB &= ~ ((1<<ReadWrite)|(1<<BiPolarMood));
BlinkLght();
DDRB = 0;
}
void SendChar (unsigned char character){
CheckIfBusy();
PORTB = character;
PORTD |= (1<<7);
PORTD &= ~(1<<2);
BlinkLght();
_delay_ms(2000);
DDRB=0;
}
int main(void)
{
DDRD |= 1<<LightSwitch | 1<<ReadWrite | 1<<BiPolarMood;
_delay_ms(15);
SendCommand(0x01); //Clear Screen 0x01 = 00000001
_delay_ms(2);
SendCommand(0x38);
_delay_us(50);
SendCommand(0b00001110);
_delay_us(50);
SendChar(0x4E); //N
SendChar(0x65); //e
SendChar(0x77); //w
SendChar(0x62); //b
SendChar(0x69); //i
SendChar(0x65); //e
SendChar(0x48); //H
SendChar(0x61); //a
SendChar(0x63); //c
SendChar(0x6B); //k
SendChar(0x2E); //.
SendChar(0x63); //c
SendChar(0x6F); //o
SendChar(0x6D); //m
while(1)
{
}
}