ورود به حساب ثبت نام جدید فراموشی کلمه عبور
برای ورود به حساب کاربری خود، نام کاربری و کلمه عبورتان را در زیر وارد کرده و روی «ورود به سایت» کلیک کنید.





اگر فرم ثبت نام برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.









اگر فرم بازیابی کلمه عبور برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.





کاربران برچسب زده شده

نمایش نتایج: از 1 به 2 از 2
  1. #1
    2013/11/17
    23
    0

    کمک در مورد راه اندازی lcd خریداری شده در سایت eca.ir

    سلام به دوستان عزیز من یک lcd از eca.ir خریدم.برنامه یک تقویم رو نوشتم برای نمایش رو این ال سی دی.
    اما جواب نمیگیرم.
    http://eshop.eca.ir/lcd/405-GLCD-64x128-گرافیکی-بک-لایت-آبی.html
    این ال سی دی به گفته سایت درایور ks0108 دارد.
    لطفا کمک کنید.
    در ضمن برای نوشتن از codevision 3.2 استفاده کردم.
    اینم کدی که نوشتم که با 2 اینتراپت خارجی مقادیر ثانیه و دقیقه و ... تغییر می کند.
    ...
    #include <mega32a.h>
    #include <stdio.h>
    #include <delay.h>
    // Graphic Display functions
    #include <glcd.h>

    // Font used for displaying text
    // on the graphic display
    #include <font5x7.h>

    // Declare your global variables here
    int sec=0,min1=0,hour=0,day=1,month=1,year=1394,m=0;
    unsigned char time[];
    unsigned char date[];
    // External Interrupt 0 service routine
    interrupt [EXT_INT0] void ext_int0_isr(void)
    {
    // Place your code here
    m=m+1;
    if(m>6){m=0;}
    }

    // External Interrupt 1 service routine
    interrupt [EXT_INT1] void ext_int1_isr(void)
    {
    // Place your code here
    if(m==1){sec=sec+1;if(sec>59){sec=0;}}
    if(m==2){min1=min1+1;if(min1>59){min1=0;}}
    if(m==3){hour=hour+1;if(hour>23){hour=0;}}
    if(m==4){day=day+1;if(day>30){day=1;}}
    if(m==5){month=month+1;if(month>12){month=1;}}
    if(m==6){year=year+1;if(year>1410){year=1394;}}
    }

    // Timer1 overflow interrupt service routine
    interrupt [TIM1_OVF] void timer1_ovf_isr(void)
    {
    // Reinitialize Timer1 value
    TCNT1H=0x85EE >> 8;
    TCNT1L=0x85EE & 0xff;
    // Place your code here
    sec=sec+1;
    }

    void main(void)
    {
    // Declare your local variables here
    // Variable used to store graphic display
    // controller initialization data
    GLCDINIT_t glcd_init_data;

    // Input/Output Ports initialization
    // Port A initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRA=(0<<DDA7) | (0<<DDA6) | (0<<DDA5) | (0<<DDA4) | (0<<DDA3) | (0<<DDA2) | (0<<DDA1) | (0<<DDA0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTA=(0<<PORTA7) | (0<<PORTA6) | (0<<PORTA5) | (0<<PORTA4) | (0<<PORTA3) | (0<<PORTA2) | (0<<PORTA1) | (0<<PORTA0);

    // Port B initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRB=(0<<DDB7) | (0<<DDB6) | (0<<DDB5) | (0<<DDB4) | (0<<DDB3) | (0<<DDB2) | (0<<DDB1) | (0<<DDB0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTB=(0<<PORTB7) | (0<<PORTB6) | (0<<PORTB5) | (0<<PORTB4) | (0<<PORTB3) | (0<<PORTB2) | (0<<PORTB1) | (0<<PORTB0);

    // Port C initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRC=(0<<DDC7) | (0<<DDC6) | (0<<DDC5) | (0<<DDC4) | (0<<DDC3) | (0<<DDC2) | (0<<DDC1) | (0<<DDC0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTC=(0<<PORTC7) | (0<<PORTC6) | (0<<PORTC5) | (0<<PORTC4) | (0<<PORTC3) | (0<<PORTC2) | (0<<PORTC1) | (0<<PORTC0);

    // Port D initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRD=(0<<DDD7) | (0<<DDD6) | (0<<DDD5) | (0<<DDD4) | (0<<DDD3) | (0<<DDD2) | (0<<DDD1) | (0<<DDD0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTD=(0<<PORTD7) | (0<<PORTD6) | (0<<PORTD5) | (0<<PORTD4) | (0<<PORTD3) | (0<<PORTD2) | (0<<PORTD1) | (0<<PORTD0);

    // Timer/Counter 0 initialization
    // Clock source: System Clock
    // Clock value: Timer 0 Stopped
    // Mode: Normal top=0xFF
    // OC0 output: Disconnected
    TCCR0=(0<<WGM00) | (0<<COM01) | (0<<COM00) | (0<<WGM01) | (0<<CS02) | (0<<CS01) | (0<<CS00);
    TCNT0=0x00;
    OCR0=0x00;

    // Timer/Counter 1 initialization
    // Clock source: System Clock
    // Clock value: 31.250 kHz
    // Mode: Normal top=0xFFFF
    // OC1A output: Disconnected
    // OC1B output: Disconnected
    // Noise Canceler: Off
    // Input Capture on Falling Edge
    // Timer Period: 1 s
    // Timer1 Overflow Interrupt: On
    // Input Capture Interrupt: Off
    // Compare A Match Interrupt: Off
    // Compare B Match Interrupt: Off
    TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1) | (0<<COM1B0) | (0<<WGM11) | (0<<WGM10);
    TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12) | (1<<CS12) | (0<<CS11) | (0<<CS10);
    TCNT1H=0x85;
    TCNT1L=0xEE;
    ICR1H=0x00;
    ICR1L=0x00;
    OCR1AH=0x00;
    OCR1AL=0x00;
    OCR1BH=0x00;
    OCR1BL=0x00;

    // Timer/Counter 2 initialization
    // Clock source: System Clock
    // Clock value: Timer2 Stopped
    // Mode: Normal top=0xFF
    // OC2 output: Disconnected
    ASSR=0<<AS2;
    TCCR2=(0<<PWM2) | (0<<COM21) | (0<<COM20) | (0<<CTC2) | (0<<CS22) | (0<<CS21) | (0<<CS20);
    TCNT2=0x00;
    OCR2=0x00;

    // Timer(s)/Counter(s) Interrupt(s) initialization
    TIMSK=(0<<OCIE2) | (0<<TOIE2) | (0<<TICIE1) | (0<<OCIE1A) | (0<<OCIE1B) | (1<<TOIE1) | (0<<OCIE0) | (0<<TOIE0);

    // External Interrupt(s) initialization
    // INT0: On
    // INT0 Mode: Falling Edge
    // INT1: On
    // INT1 Mode: Falling Edge
    // INT2: Off
    GICR|=(1<<INT1) | (1<<INT0) | (0<<INT2);
    MCUCR=(1<<ISC11) | (0<<ISC10) | (1<<ISC01) | (0<<ISC00);
    MCUCSR=(0<<ISC2);
    GIFR=(1<<INTF1) | (1<<INTF0) | (0<<INTF2);

    // USART initialization
    // USART disabled
    UCSRB=(0<<RXCIE) | (0<<TXCIE) | (0<<UDRIE) | (0<<RXEN) | (0<<TXEN) | (0<<UCSZ2) | (0<<RXB8) | (0<<TXB8);

    // Analog Comparator initialization
    // Analog Comparator: Off
    // The Analog Comparator's positive input is
    // connected to the AIN0 pin
    // The Analog Comparator's negative input is
    // connected to the AIN1 pin
    ACSR=(1<<ACD) | (0<<ACBG) | (0<<ACO) | (0<<ACI) | (0<<ACIE) | (0<<ACIC) | (0<<ACIS1) | (0<<ACIS0);
    SFIOR=(0<<ACME);

    // ADC initialization
    // ADC disabled
    ADCSRA=(0<<ADEN) | (0<<ADSC) | (0<<ADATE) | (0<<ADIF) | (0<<ADIE) | (0<<ADPS2) | (0<<ADPS1) | (0<<ADPS0);

    // SPI initialization
    // SPI disabled
    SPCR=(0<<SPIE) | (0<<SPE) | (0<<DORD) | (0<<MSTR) | (0<<CPOL) | (0<<CPHA) | (0<<SPR1) | (0<<SPR0);

    // TWI initialization
    // TWI disabled
    TWCR=(0<<TWEA) | (0<<TWSTA) | (0<<TWSTO) | (0<<TWEN) | (0<<TWIE);

    // Graphic Display Controller initialization
    // The KS0108 connections are specified in the
    // Project|Configure|C Compiler|Libraries|Graphic Display menu:
    // DB0 - PORTA Bit 7
    // DB1 - PORTA Bit 6
    // DB2 - PORTA Bit 5
    // DB3 - PORTA Bit 4
    // DB4 - PORTA Bit 3
    // DB5 - PORTA Bit 2
    // DB6 - PORTA Bit 1
    // DB7 - PORTA Bit 0
    // E - PORTC Bit 7
    // RD /WR - PORTC Bit 6
    // RS - PORTC Bit 5
    // /RST - PORTC Bit 4
    // CS1 - PORTC Bit 2
    // CS2 - PORTC Bit 3

    // Specify the current font for displaying text
    glcd_init_data.font=font5x7;
    // No function is used for reading
    // image data from external memory
    glcd_init_data.readxmem=NULL;
    // No function is used for writing
    // image data to external memory
    glcd_init_data.writexmem=NULL;

    glcd_init(&glcd_init_data);

    // Global enable interrupts
    #asm("sei&quot

    while (1)
    {
    // Place your code here
    while(m==1){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:",hour,min1);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==2){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d: :%02d",hour,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==3){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time," :%02d:%02d",min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==4){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date,"%04d/%02d/ ",year,month);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==5){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date,"%04d/ /%02d",year,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==6){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date," /%02d/%02d",month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    //................................
    while(m==0){if(sec>59){min1=min1+1;sec=0;}
    if(min1>59){hour=hour+1;min1=0;}
    if(hour>23){hour=0;day=day+1;}
    if(day>30){month=month+1;day=1;}
    if(month>12){year=year+1;month=1;}
    if(year>1410){year=1394;}
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    }
    }
    }
    .................................................. .................
  2. #2
    2014/05/29
    قدس
    1,228
    124

    پاسخ : کمک در مورد راه اندازی lcd خریداری شده در &#

    دو تا پروژه نوشتم با این نوع lcd


    http://dmf313.ir/%D9%BE%D8%B1%D9%88%DA%98%D9%87-%D8%B3%D8%A7%D8%B9%D8%AA-%D8%AF%DB%8C%D8%AC%DB%8C%D8%AA%D8%A7%D9%84-%D8%A8%D8%A7-lcd-%DA%AF%D8%B1%D8%A7%D9%81%DB%8C%DA%A9%DB%8C/





    http://dmf313.ir/%D8%B2%DB%8C%D8%A8%D8%A7%D8%AA%D8%B1%DB%8C%D9%86-%D8%AF%D9%85%D8%A7%D8%B3%D9%86%D8%AC-%D8%A8%D8%A7-lcd-%DA%AF%D8%B1%D8%A7%D9%81%DB%8C%DA%A9%DB%8C-%D9%86%D8%B3%D8%AE%D9%872/




    آموزش کار باهاش هم تو سایت گزاشتم....در ضمن کد هات رو همیشه به صورت زیر بزار
    [code=c]#include <mega32a.h>
    #include <stdio.h>
    #include <delay.h>
    // Graphic Display functions
    #include <glcd.h>

    // Font used for displaying text
    // on the graphic display
    #include <font5x7.h>

    // Declare your global variables here
    int sec=0,min1=0,hour=0,day=1,month=1,year=1394,m=0;
    unsigned char time[];
    unsigned char date[];
    // External Interrupt 0 service routine
    interrupt [EXT_INT0] void ext_int0_isr(void)
    {
    // Place your code here
    m=m+1;
    if(m>6){m=0;}
    }

    // External Interrupt 1 service routine
    interrupt [EXT_INT1] void ext_int1_isr(void)
    {
    // Place your code here
    if(m==1){sec=sec+1;if(sec>59){sec=0;}}
    if(m==2){min1=min1+1;if(min1>59){min1=0;}}
    if(m==3){hour=hour+1;if(hour>23){hour=0;}}
    if(m==4){day=day+1;if(day>30){day=1;}}
    if(m==5){month=month+1;if(month>12){month=1;}}
    if(m==6){year=year+1;if(year>1410){year=1394;}}
    }

    // Timer1 overflow interrupt service routine
    interrupt [TIM1_OVF] void timer1_ovf_isr(void)
    {
    // Reinitialize Timer1 value
    TCNT1H=0x85EE >> 8;
    TCNT1L=0x85EE & 0xff;
    // Place your code here
    sec=sec+1;
    }

    void main(void)
    {
    // Declare your local variables here
    // Variable used to store graphic display
    // controller initialization data
    GLCDINIT_t glcd_init_data;

    // Input/Output Ports initialization
    // Port A initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRA=(0<<DDA7) | (0<<DDA6) | (0<<DDA5) | (0<<DDA4) | (0<<DDA3) | (0<<DDA2) | (0<<DDA1) | (0<<DDA0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTA=(0<<PORTA7) | (0<<PORTA6) | (0<<PORTA5) | (0<<PORTA4) | (0<<PORTA3) | (0<<PORTA2) | (0<<PORTA1) | (0<<PORTA0);

    // Port B initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRB=(0<<DDB7) | (0<<DDB6) | (0<<DDB5) | (0<<DDB4) | (0<<DDB3) | (0<<DDB2) | (0<<DDB1) | (0<<DDB0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTB=(0<<PORTB7) | (0<<PORTB6) | (0<<PORTB5) | (0<<PORTB4) | (0<<PORTB3) | (0<<PORTB2) | (0<<PORTB1) | (0<<PORTB0);

    // Port C initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRC=(0<<DDC7) | (0<<DDC6) | (0<<DDC5) | (0<<DDC4) | (0<<DDC3) | (0<<DDC2) | (0<<DDC1) | (0<<DDC0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTC=(0<<PORTC7) | (0<<PORTC6) | (0<<PORTC5) | (0<<PORTC4) | (0<<PORTC3) | (0<<PORTC2) | (0<<PORTC1) | (0<<PORTC0);

    // Port D initialization
    // Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
    DDRD=(0<<DDD7) | (0<<DDD6) | (0<<DDD5) | (0<<DDD4) | (0<<DDD3) | (0<<DDD2) | (0<<DDD1) | (0<<DDD0);
    // State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
    PORTD=(0<<PORTD7) | (0<<PORTD6) | (0<<PORTD5) | (0<<PORTD4) | (0<<PORTD3) | (0<<PORTD2) | (0<<PORTD1) | (0<<PORTD0);

    // Timer/Counter 0 initialization
    // Clock source: System Clock
    // Clock value: Timer 0 Stopped
    // Mode: Normal top=0xFF
    // OC0 output: Disconnected
    TCCR0=(0<<WGM00) | (0<<COM01) | (0<<COM00) | (0<<WGM01) | (0<<CS02) | (0<<CS01) | (0<<CS00);
    TCNT0=0x00;
    OCR0=0x00;

    // Timer/Counter 1 initialization
    // Clock source: System Clock
    // Clock value: 31.250 kHz
    // Mode: Normal top=0xFFFF
    // OC1A output: Disconnected
    // OC1B output: Disconnected
    // Noise Canceler: Off
    // Input Capture on Falling Edge
    // Timer Period: 1 s
    // Timer1 Overflow Interrupt: On
    // Input Capture Interrupt: Off
    // Compare A Match Interrupt: Off
    // Compare B Match Interrupt: Off
    TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1) | (0<<COM1B0) | (0<<WGM11) | (0<<WGM10);
    TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12) | (1<<CS12) | (0<<CS11) | (0<<CS10);
    TCNT1H=0x85;
    TCNT1L=0xEE;
    ICR1H=0x00;
    ICR1L=0x00;
    OCR1AH=0x00;
    OCR1AL=0x00;
    OCR1BH=0x00;
    OCR1BL=0x00;

    // Timer/Counter 2 initialization
    // Clock source: System Clock
    // Clock value: Timer2 Stopped
    // Mode: Normal top=0xFF
    // OC2 output: Disconnected
    ASSR=0<<AS2;
    TCCR2=(0<<PWM2) | (0<<COM21) | (0<<COM20) | (0<<CTC2) | (0<<CS22) | (0<<CS21) | (0<<CS20);
    TCNT2=0x00;
    OCR2=0x00;

    // Timer(s)/Counter(s) Interrupt(s) initialization
    TIMSK=(0<<OCIE2) | (0<<TOIE2) | (0<<TICIE1) | (0<<OCIE1A) | (0<<OCIE1B) | (1<<TOIE1) | (0<<OCIE0) | (0<<TOIE0);

    // External Interrupt(s) initialization
    // INT0: On
    // INT0 Mode: Falling Edge
    // INT1: On
    // INT1 Mode: Falling Edge
    // INT2: Off
    GICR|=(1<<INT1) | (1<<INT0) | (0<<INT2);
    MCUCR=(1<<ISC11) | (0<<ISC10) | (1<<ISC01) | (0<<ISC00);
    MCUCSR=(0<<ISC2);
    GIFR=(1<<INTF1) | (1<<INTF0) | (0<<INTF2);

    // USART initialization
    // USART disabled
    UCSRB=(0<<RXCIE) | (0<<TXCIE) | (0<<UDRIE) | (0<<RXEN) | (0<<TXEN) | (0<<UCSZ2) | (0<<RXB8) | (0<<TXB8);

    // Analog Comparator initialization
    // Analog Comparator: Off
    // The Analog Comparator's positive input is
    // connected to the AIN0 pin
    // The Analog Comparator's negative input is
    // connected to the AIN1 pin
    ACSR=(1<<ACD) | (0<<ACBG) | (0<<ACO) | (0<<ACI) | (0<<ACIE) | (0<<ACIC) | (0<<ACIS1) | (0<<ACIS0);
    SFIOR=(0<<ACME);

    // ADC initialization
    // ADC disabled
    ADCSRA=(0<<ADEN) | (0<<ADSC) | (0<<ADATE) | (0<<ADIF) | (0<<ADIE) | (0<<ADPS2) | (0<<ADPS1) | (0<<ADPS0);

    // SPI initialization
    // SPI disabled
    SPCR=(0<<SPIE) | (0<<SPE) | (0<<DORD) | (0<<MSTR) | (0<<CPOL) | (0<<CPHA) | (0<<SPR1) | (0<<SPR0);

    // TWI initialization
    // TWI disabled
    TWCR=(0<<TWEA) | (0<<TWSTA) | (0<<TWSTO) | (0<<TWEN) | (0<<TWIE);

    // Graphic Display Controller initialization
    // The KS0108 connections are specified in the
    // Project|Configure|C Compiler|Libraries|Graphic Display menu:
    // DB0 - PORTA Bit 7
    // DB1 - PORTA Bit 6
    // DB2 - PORTA Bit 5
    // DB3 - PORTA Bit 4
    // DB4 - PORTA Bit 3
    // DB5 - PORTA Bit 2
    // DB6 - PORTA Bit 1
    // DB7 - PORTA Bit 0
    // E - PORTC Bit 7
    // RD /WR - PORTC Bit 6
    // RS - PORTC Bit 5
    // /RST - PORTC Bit 4
    // CS1 - PORTC Bit 2
    // CS2 - PORTC Bit 3

    // Specify the current font for displaying text
    glcd_init_data.font=font5x7;
    // No function is used for reading
    // image data from external memory
    glcd_init_data.readxmem=NULL;
    // No function is used for writing
    // image data to external memory
    glcd_init_data.writexmem=NULL;

    glcd_init(&glcd_init_data);

    // Global enable interrupts
    #asm("sei&quot

    while (1)
    {
    // Place your code here
    while(m==1){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:",hour,min1);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==2){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d: :%02d",hour,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==3){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time," :%02d:%02d",min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==4){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date,"%04d/%02d/ ",year,month);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==5){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date,"%04d/ /%02d",year,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    while(m==6){sprintf(time,"%02d:%02d:%02d&quot ;,hour,min1,sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date," /%02d/%02d",month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    delay_ms(200);}
    //................................
    while(m==0){if(sec>59){min1=min1+1;sec=0;}
    if(min1>59){hour=hour+1;min1=0;}
    if(hour>23){hour=0;day=day+1;}
    if(day>30){month=month+1;day=1;}
    if(month>12){year=year+1;month=1;}
    if(year>1410){year=1394;}
    sprintf(time,"%02d:%02d:%02d",hour,min1, sec);
    sprintf(date,"%04d/%02d/%02d",year,month,day);
    glcd_clear();
    glcd_setlinestyle(3,GLCD_LINE_SOLID);
    glcd_rectrel(0,0,255,63);
    glcd_outtextxy(5,50,time);
    glcd_outtextxy(5,5,date);
    }
    }
    }[/code]
    اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ وآلِ مُحَمَّدٍ وعَجِّلْ فَرَجَهُمْ

    اگه دوس دارید سریع به جواب برسید :
    1) قبل از پرسیدن سوال، بسرچید.
    2) سوالاتون رو با جزئیات کامل مطرح کنید.
نمایش نتایج: از 1 به 2 از 2

موضوعات مشابه

  1. راه اندازی LCD 7اینچ سایت
    توسط p1000i در انجمن پروسسورهای ARM
    پاسخ: 2
    آخرين نوشته: 2015/08/15, 08:11
  2. طرز راه اندازی اژیرهای موجود در سایت
    توسط saeedxs در انجمن الكترونيك صنعتی
    پاسخ: 3
    آخرين نوشته: 2015/04/21, 22:53
  3. خریداری ترانس
    توسط ueue در انجمن منابع تغذيه
    پاسخ: 31
    آخرين نوشته: 2013/03/08, 01:17
  4. مشکل با لامینت خریداری شده.(میتونید حل کنید؟)
    توسط haji125 در انجمن مدار چاپی (PCB)
    پاسخ: 12
    آخرين نوشته: 2010/12/20, 22:46
  5. راه اندازی بخش ویکی برای سایت
    توسط anrico_lc در انجمن گفتگو درباره ECA
    پاسخ: 13
    آخرين نوشته: 2008/10/04, 05:56

کلمات کلیدی این موضوع

علاقه مندي ها (Bookmarks)

علاقه مندي ها (Bookmarks)

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •