CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem receiving data from PC using the MAX 232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arun
Guest







Problem receiving data from PC using the MAX 232
PostPosted: Thu Nov 18, 2004 10:52 am     Reply with quote

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);


}
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Nov 18, 2004 5:33 pm     Reply with quote

The following line is not required and might interfere:
Code:
 output_float(pin_c7);

Remove this line and try again.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group