This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

i have done basic c programming for this project but i dont know how can i do this for 89c51.

so i have two input values.
val1:- it is fetched from a notepad file after every 15 minitues but for faster working here hi have taken it in two seconds. this input goes in to p1.i also meed suggestions for how can i get this inputs into this procesor every 15 minites. only one input at a time and as soon as new input is here old one vanishes.

val2:- it's taken from notepad file too. it goes into p2. it's only one constant value.

now we compare the val1 and val2 output of this can be any where. if val2 is higher than val1 output is positive(on,1). otherwise off or zero.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{ FILE *fp,*fp1; char ch,ch2; int val,val2; clrscr(); fp = fopen("abc.txt","r"); fp1 = fopen("xyz.txt","r"); ch = fgetc(fp); ch2 = fgetc(fp1); printf("%c",ch2); val = (int)ch - 48; val2 = (int)ch2 - 48; printf(":%d:",val); printf("\n%d",val2); while(ch != EOF) { ch = fgetc(fp); if(ch == '\n') { printf("->%d\n",val); delay(2000); val = 0; } else { val = (10 * val) + ((int)ch - 48); if(val2>val) printf("1\n"); else printf("0\n"); // printf("%c",ch); } } getch();
} if you want to run it in c with notepad file. mail me shahkevan540@gmail.com i will send you real files.

Parents
  • I'd like to help, but your code looks way too complicated for me.

    Maybe if you formatted it in such a way that us mere mortals could understand it?

    Maybe follow the forum posting guidelines?

Reply
  • I'd like to help, but your code looks way too complicated for me.

    Maybe if you formatted it in such a way that us mere mortals could understand it?

    Maybe follow the forum posting guidelines?

Children
No data