89C2051 - serial output

Thread Starter

Jefecito20

Joined Apr 26, 2010
6
I'm programming an ADC using an AT89C2051 microcontroller and then need it to provide a serial output to transmit via RF 315 MHz. So far, my ADC seems to be programmed properly, but the P3.1 pin (txd for 89C2051) does not show any output. Can anyone please help me with the flaws in my program?

I'm using Keil v2.0 to compile it.

#include <REG2051.H>

sbit RD = P3^4;
sbit WR = P3^5;
sbit INTR = P3^7;
sfr MYDATA = 0x90;

void send(unsigned char);

void main()
{
unsigned char value;
MYDATA = 0xFF;
RD = 1;
WR = 1;

while(1)
{
WR = 0;
WR = 1;
while(INTR == 1);
RD = 0;
value = MYDATA;
send(value);
RD = 1;
}
}

void send(unsigned char value1)
{
TMOD = 0x20;
TH1 = 0xFA;
SCON = 0x50;
TR1 = 1;
SBUF = value1;
while (TI == 0);
TI = 0;
}
 

Thread Starter

Jefecito20

Joined Apr 26, 2010
6
@retched: I thought pin P3.1 is always the serial output. How do I set it?

@GetDeviceInfo: Baud rate of 4800. I'm using the timer in mode 2, so I don't think I have to set TL1.

I'm transmitting the output through RF and displaying it on an LCD.
 
Top