i got the hint I am totally new to 8051 hardware as well as software.Tell me if my coding is in correct direction[/B] if I wan to write 4 bit binary data on rs232 through SBUF
taken nibble of P3
convert to hex
convert to decimal
convert to binary
write each bit in SBUF + 48
Problem is getting symbols now also
my code is given below
#include <ADI\ADUC831.h>
#include<stdio.h>
#include<math.h>
//#include<library.h>
BIT z P3.7;
int sendbyte();
void main ()
{
int num,num1,ex,ex1,ex2,ex3,a,b,c,d;
TH1 = 0xfd ;
TL1 = 0xfd ;
PCON |= 0x80 ;
SCON = 0x70 ;
TMOD = 0x20 ;
TCON = 0x40 ;
while(1)
{
if(z)
{
num=lo_nibb(P3);
printf("\n %x",num);
num1=(num % 16);
printf("\n %d\n",num1);
a=num1/2;
ex=(num1 % 2);
SBUF=(ex + 48);
//SBUF='G';
//while(!TI=0)
//TI=0;
b=a/2;
ex1=(a % 2);
SBUF=(ex1 + 48);
//while(!TI=0)
//TI=0;
c=b/2;
ex2=(b % 2);
SBUF=(ex2 + 48);
//while(!TI=0)
//TI=0;
d=c/2;
ex3=(c % 2);
SBUF=(ex3 + 48);
//while(!TI=0)
//TI=0;
}
else
SBUF='A';
}}
regards
khn