Philip
05-01-08, 08:38 AM
Sir
I wrote a visual basic program which i use to communicate with my NMI0016.
The code was intended to send a character or a string to the micro, the micro will then validate the string receive and send the corresponding responds back to the pc.
However after the micros validation it doesn't send the responds but it
sends back the string it received for the respond please help.
Below is the micro side of the code:
#include clib\common51.c
#include clib\syslib51.c
#include clib\stdio.h
#include clib\fputc.c
#include clib\fputs.c
#include clib\fgetc.c
#include clib\fgets.c
main()
{
int i;
char cin;
char cout;
char clear;
while(1)
{
cin =fgets(stdin);
if (cin == 'P')
{
cout= 'PHILIP'
fputs(cout,stdout);
}
if (cin == 'A')
{
cout= 'APPIAH'
fputs(cout,stdout);
}
if (cin == 'K')
{
cout= 'KUNDO'
fputs(cout,stdout);
}
}
}
Thank You
I wrote a visual basic program which i use to communicate with my NMI0016.
The code was intended to send a character or a string to the micro, the micro will then validate the string receive and send the corresponding responds back to the pc.
However after the micros validation it doesn't send the responds but it
sends back the string it received for the respond please help.
Below is the micro side of the code:
#include clib\common51.c
#include clib\syslib51.c
#include clib\stdio.h
#include clib\fputc.c
#include clib\fputs.c
#include clib\fgetc.c
#include clib\fgets.c
main()
{
int i;
char cin;
char cout;
char clear;
while(1)
{
cin =fgets(stdin);
if (cin == 'P')
{
cout= 'PHILIP'
fputs(cout,stdout);
}
if (cin == 'A')
{
cout= 'APPIAH'
fputs(cout,stdout);
}
if (cin == 'K')
{
cout= 'KUNDO'
fputs(cout,stdout);
}
}
}
Thank You