arun Guest
|
Problem receiving data from PC using the MAX 232 |
Posted: Thu Nov 18, 2004 10:52 am |
|
|
Hi,
I am using a MAX 232 IC for RS 232 communications. I am having problem receiving data from the PC , but I am having no trouble sending data to the PC.
I used a oscilloscope to check the pulses and I noticed that I get pulses on the MAX pin 8 when pin_c7 of 16F877 is not connected to the MAX.
The MAX 232 IC is connected using the standard techniques . the code is given below.
#include <16F877.h>
#FUSES XT,NOWDT,NOBROWNOUT, NOLVP, NOWRT
#use delay(clock=4000000)
#use standard_io(C)
#use rs232(baud=9600,xmit=pin_c6, rcv=pin_c7,parity=n)
enum enmType {TXDONLY,RXDONLY,TXDRXD};
int nType,bHigh;
void init()
{
setup_adc_ports(no_analogs);
setup_adc(adc_off);
set_tris_a(0xFF);
set_tris_b(0xFF);
set_tris_d(0xC0);
//set_tris_c(0xAF);
output_float(pin_c7);
nType=TXDONLY;
set_timer2(0);
setup_timer_2(T2_DIV_BY_1,0xFF,1);
}
void main()
{
init();
do
{
switch (nType)
{
case TXDONLY:
putc('A');
break;
case RXDONLY:
bHigh=0;
break;
case TXDRXD:
putc( getc()+1 );
break;
}
} while(TRUE);
} |
|