hello all here is my program which it cannot simulat please if is it possible do it in your system and tel me my mistake thanks for all
#include <at89x051.h> #include "stdio.h" #include <stdlib.h> #include <math.h> #include "lcd.h" static unsigned char j=0,k=0,l,m ,minute_cont=0; static unsigned int day ,second , minute , hour,hour_str[1],minute_str[1] ; bit hit,gat,gat1; void clock(void); void initialize (void); void initialize( void ) { /* setup the timer 0 interrupt */ TMOD= 0x16;// timer0 initialize 8 bit auto reload external counter mode 2 TH0 = -64; // input clk = 64khz interrupt occur every 64*(15.625micro secondset)=1ms TL0 = -64; EA=1; ET0=1; //timer 0 interrupt enable TR0=1; ET1=0; EX1=0; EX0=0; // ENABLE EXTERNAL 0 INTERRUPT SYNC LOSS IT0=0; // EXTERNAL INTERRUPT 0 IS FALLING EDGE-TRIGGERE second = 0 ; minute = 0 ; hour = 0 ; day = 0 ; lcd_reset(); } void main(void) { char data buf1[20]; initialize(); for(;;) { P3_0=1; hit=P3_0; if(minute_cont==0) { gat=1; gat1=gat&hit; if(gat1==1) { minute_cont=5; minute_str[j]=minute; hour_str[j]=hour; if(j<5) j++; } } if(sw1==0) { for(k=0;k<5;k++) { sprintf(buf1,"%02uH %02uM",hour_str[k],minute_str[k]); string_to_lcd_line(buf1,LCD_lINE_1); for(l=0;l<150;l++) for(m=0;m<150;m++); } } sprintf (buf1,"%02dd %02dh %02dm %02ds",day,hour,minute,second); string_to_lcd_line(buf1,LCD_lINE_1); } } void clock (void) { if ( ++second == 60 ) { second=0; minute_cont--; if ( ++minute == 60 ) { minute=0; if ( ++hour == 24 ) { hour=0; if ( ++day >=99 ) { day=0; } } } } } void timer0 (void) interrupt 1 using 3 /* Int Vector at 000BH, Reg Bank 1 */ { static unsigned char interrupt_count = 0; static unsigned char deci_sec = 0; if (++interrupt_count == 100) //100 { // 64000/64=1000 100 * one_mili_second = 1 decisec =0.1 sec interrupt_count = 0 ; if (++deci_sec == 10 ) //10 { deci_sec=0; clock(); } } TF0=0; EA=1; }
"here is my program which it cannot simulat" What exactly prevents you from simulating it? Can you build it without errors or warnings? As you haven't even managed to select a toolset for this post, I guess you haven't configured it correctlyl. Have you read the Getting Started Guide, so that you know how to use the tools properly?
"do it in your system and tel me my mistake" Sorry, my system doesn't have your lcd.h, lcd_reset(), or string_to_lcd_line().
Even without having a complete compilable project, I can see some problems. hour_str[] and minute_str[] arrays each hold only one element, yet your program tries to access nonexistent elements 1-4 of each array.
a question: what is the misspell? -emulate with a mistyped 's' in front or simulate where an 'i' is replaced by an 'e'. The answer will be very different Erik