1.) Is it necessary to use RC7 (16F877A) as the RCV pin in RS232 in order to use #INT_RDA? Or it doesn't matter what pin I would use?
2.) If I’ll be using two #RS232 functions with different XMIT and RCV pins (2 pins for xmit and 2 pins for rcv), would that affect the #INT_RDA I set up for one of the RCV pins?
Thank you...
-=alDin=-
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
Posted: Wed Jan 18, 2006 2:56 am
Quote:
1.) Is it necessary to use RC7 (16F877A) as the RCV pin in RS232 in order to use #INT_RDA? Or it doesn't matter what pin I would use?
Only RC7 can be used for #int_RDA. No other options are available.
Quote:
2.) If I’ll be using two #RS232 functions with different XMIT and RCV pins (2 pins for xmit and 2 pins for rcv), would that affect the #INT_RDA I set up for one of the RCV pins?
The #INT_RDA will work for the rcv connected to pin RC7 but it might affect the data received on the other stream.
Try to understand the internal workings of the PIC processor. The CCS provided function #RS232 functionality is very nice but can not work miracles. When you specify the pins RC6 and RC7 to the #RS232 declaration then the compiler knows you want to use the internal hardware UART. By specifying other pins the compiler will generate a software UART for you. The CCS software UART has limited capabilities, for example:
- it can not generate interrupts
- it can not buffer data
- it can not send and receive data simultaneously
- interrupts occurring during data receive or transmit will affect the timing and cause communication errors (mangled characters).
There is only one hardware UART in the 16F877A which is connected to RC6 and RC7. Only the hardware UART can generate interrupts.
Trying to implement multiple serial streams, where one ore more software UARTs are involved, is a potential nightmare. Try to design your system so that only one serial stream will be active at any time, this will prevent problems from the streams interferring each other.
I can recommend to buy the book PIC Microcontroller Serial Communications by Roger L. Stevens. This book contains detailed info on serial communications including source code for improved software UARTs under interrupt control (he uses int_ext to create an alternative for the int_rda).
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