|
|
View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
Power up and #use RS232 |
Posted: Fri Dec 23, 2005 11:06 am |
|
|
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
|
|
Posted: Fri Dec 23, 2005 3:42 pm |
|
|
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
|
|
Posted: Fri Dec 23, 2005 6:01 pm |
|
|
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
|
|
Posted: Tue Dec 27, 2005 3:13 am |
|
|
The error was in the first part of start-up when I put, as usually, all port in zero state.
Thanks for support,
Fabri |
|
|
|
|
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
|