![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
leonardo.araujo
Joined: 28 Jan 2004 Posts: 0 Location: Brasil
|
Can I use 2 or more fuse #rs-232 on the same PIC |
Posted: Fri Feb 13, 2004 9:23 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Al
Joined: 13 Nov 2003 Posts: 28 Location: Belfast
|
|
Posted: Fri Feb 13, 2004 10:46 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
arunb1 Guest
|
RE: |
Posted: Fri Feb 13, 2004 11:34 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: RE: |
Posted: Fri Feb 13, 2004 12:29 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
Re: RE: |
Posted: Fri Feb 13, 2004 3:26 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|