View previous topic :: View next topic |
Author |
Message |
Mattr0
Joined: 27 Mar 2005 Posts: 30
|
RS-232 Interrupt |
Posted: Thu Feb 16, 2006 12:51 pm |
|
|
Is it possible for the interrupt routine to interrupt off of pins other than the uart. I am finishing a job that soeone else started and on the circuit board they used pin b3 for recieve and b4 for transmit. I can use the timer and lookat it every so often but I was wondering if this was possible. The Micro is 18f452
Thanks |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Feb 16, 2006 1:13 pm |
|
|
YES.
Look up port B on page 94
http://ww1.microchip.com/downloads/en/devicedoc/39564b.pdf
It shows int on change. An external interupt. one for capture compair...
You must read the spec sheet.
Last edited by treitmey on Thu Feb 16, 2006 1:18 pm; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Thu Feb 16, 2006 1:14 pm |
|
|
You can't use the RDA interrupt unless you use the built-in USART. If you use other pins, the RDA interrupt can't be used.
I think you're out of luck there. RX is on B3, and TX on B4. If RX was on B0, B1 or B2 you could use one of the external interrupts to generate a quasi-RDA-like receive interrupt. If you're able to swap RX to B4 and TX to B3, then you could use the interrupt on change (RB) to implement a quasi-RDA-like receive interrupt. |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Feb 16, 2006 1:24 pm |
|
|
I see what you mean newguy. Can he use the B3 CCP2 in caputure to IRQ when data is recieved. TX should'nt be a problem at low speeds.
Remember. If you don't use the hardware USART pins you don't get a usart.
This is going to be a software serial port. |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Thu Feb 16, 2006 1:34 pm |
|
|
I never thought of the CCP2 input on B3. I suppose he could bodge together another receive-like interrupt using that too.
We need a "who's going to take this one?" button - we posted within seconds of each other that first time. ![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Mattr0
Joined: 27 Mar 2005 Posts: 30
|
|
Posted: Thu Feb 16, 2006 1:38 pm |
|
|
well thanks guys but I think I will just use a timer to look at it eery so often. |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Feb 16, 2006 1:45 pm |
|
|
I bet you'll miss data. I would just run a PCB repair wire to the hardware usart pins you want. It won't look pretty. But it will work. |
|
![](templates/subSilver/images/spacer.gif) |
|