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

Power up and #use RS232

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

Power up and #use RS232
PostPosted: Fri Dec 23, 2005 11:06 am     Reply with quote

Hi Everybody,

I'm using #USE RS232 in PIC without USART.

Every power up, the first character receved is incorrect. In second time all work fine.

I belive there's a noise on power supply.

I put #use rs232 on the top of project and after one second of power-up I start to control kbhit().

Is possible to reset RS232 software or start it in second time ?

Thanks for support,
Ttelmah
Guest







PostPosted: Fri Dec 23, 2005 3:42 pm     Reply with quote

Are you sure the unit at the other end, is pulling the pin you use as a serial input, 'high', when it first starts?. A check with a scope may be called for. I'd suggest setting the RX line as an input, and driving the TX line high yourself, right at the start of your code, then waiting till you see the RX line as 'high', before proceeding. So, something like:
Code:

#define RXPIN PIN_B2   //set to suit
#define TXPIN PIN_B3   //Set to suit
#use RS232 (xmit=TXPIN,rcv=RXPIN,PARITY=N,BITS=8,baud=9600)

//Then in main
output_float(RXPIN);
output_high(TXPIN);
delay_us(10);
while (input(RXPIN)==0) ; //Delay here for the pin to rise

//I'd add an 'error' timeout if the pin is not high in a couple of seconds.
//Now start your normal code.


Best Wishes
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Dec 23, 2005 6:01 pm     Reply with quote

Quote:

put #use rs232 on the top of project and after one second of power-up I start to control kbhit().


If you are using a level translator transceiver in the RS232 front end, be aware that they have a pump charge power supply to generate the -V required for RS232 and it takes it's time to reach the expected value.


Humberto
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue Dec 27, 2005 3:13 am     Reply with quote

The error was in the first part of start-up when I put, as usually, all port in zero state.

Thanks for support,
Fabri
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