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 CCS Technical Support

Can I use 2 or more fuse #rs-232 on the same PIC

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



Joined: 28 Jan 2004
Posts: 0
Location: Brasil

View user's profile Send private message Send e-mail

Can I use 2 or more fuse #rs-232 on the same PIC
PostPosted: Fri Feb 13, 2004 9:23 am     Reply with quote

I�m working on a project that could control via rs-232 a large number of equipment.
Does someone knows how can I use 2 or more rs-232 on the same PIC or how can I implement rs-232 via code
Al



Joined: 13 Nov 2003
Posts: 28
Location: Belfast

View user's profile Send private message

PostPosted: Fri Feb 13, 2004 10:46 am     Reply with quote

You need to specify your 2 RS232 streams as follows

#use rs232(baud=4800,xmit=PIN_C6,rcv=PIN_C7,parity=N,bits=8,STREAM=GSM)

#use rs232(baud=4800,xmit=PIN_D2,rcv=PIN_D1,parity=N,bits=8, ERRORS, STREAM=GPS)

NOTE: Stream names and Pin assignments - allocate these as you require.

Then to communicate with easch stream use:

inchar=getc(GPS);

or

inchar=getc(GSM);

and appropriate output command

value = fputc(cdata, GPS)


or

fprintf (GSM, cstring, values...)
_________________
Alan Murray
arunb1
Guest







RE:
PostPosted: Fri Feb 13, 2004 11:34 am     Reply with quote

Hi,

Just want to know How can I get an interrupt from the second RS 232.
I am using a PIC 16F628 that contains only one RS 232 interface , the second one declared, now I want to receive the INT_RDA interrupts for the second RS 232 interface ( non Hardware USART).

cheers
arun
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: RE:
PostPosted: Fri Feb 13, 2004 12:29 pm     Reply with quote

arunb1 wrote:
Hi,

Just want to know How can I get an interrupt from the second RS 232.
I am using a PIC 16F628 that contains only one RS 232 interface , the second one declared, now I want to receive the INT_RDA interrupts for the second RS 232 interface ( non Hardware USART).

cheers
arun


You can't get there from here. That second port you declared is a software port. Recieving on a software port requires the full attention of the program. If you use pin B0 as the recieve pin for the software port you can detect the start bit change using the int_ext interupt and then begin listening to the software port.
Ttelmah
Guest







Re: RE:
PostPosted: Fri Feb 13, 2004 3:26 pm     Reply with quote

Neutone wrote:
arunb1 wrote:
Hi,

Just want to know How can I get an interrupt from the second RS 232.
I am using a PIC 16F628 that contains only one RS 232 interface , the second one declared, now I want to receive the INT_RDA interrupts for the second RS 232 interface ( non Hardware USART).

cheers
arun


You can't get there from here. That second port you declared is a software port. Recieving on a software port requires the full attention of the program. If you use pin B0 as the recieve pin for the software port you can detect the start bit change using the int_ext interupt and then begin listening to the software port.


You _may_ be able to get 'close'. If the receive serial line is connected to one of the external interrupt pins, and this is programmed to generate an interrupt on falling edge (assuming normal TTL serial levels), then the system will interrupt on the start bit of the serial character, and you can run the 'polled' receive routine.
This only works for receive, and is only reliable for relatively slow baud rates.
The alternatives are to switch to a PIC with dual UARTs, or to use a chip like the MAX3110E for the second UART, connected to the SPI port. This provides a complete UART, BRG, and the serial buffers, all in one package. It has an interrupt output, that can be connected to any suitable input on the PIC. This is really the only way to go, if the serials are high data rate, and transmission/reception is required on both channels at once.

Best Wishes
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