View previous topic :: View next topic |
Author |
Message |
sukrucevik
Joined: 05 Feb 2007 Posts: 1
|
18f6720 and two UART |
Posted: Mon Feb 05, 2007 3:40 pm |
|
|
Hello,
I have some problems about 18f6720 UARTs. I want to use UART with interrupts. But I can't. Ican send datas but i can't get datas.
Are there anyone who wants help?
Thanks |
|
|
Ttelmah Guest
|
|
Posted: Tue Feb 06, 2007 5:16 am |
|
|
The second interrupt, is int_rda2.
Just code a second routine, just like the normal int_rda routine, but with different names for the buffers etc., ung this name, and enable this interrupt.
Best Wishes |
|
|
meereck
Joined: 09 Nov 2006 Posts: 173
|
|
Posted: Tue Feb 06, 2007 6:07 am |
|
|
Hello, I have slightly similar question : I am thinking about making an interface for RS485. A PIC18 with 2 RS485 lines connected to 2 MAX485. Do I need a PIC with 2 HW USART ports or mere 1 USART is enough (and the second one will be SW?)?
I would like to build a device which will be a mediator between other 2 RS485 devices (a data flows : dev1<>my_device<>dev2 (i.e 2 different RS485 lines)). Hope I explained it well.
thanks in advance,
BR M. |
|
|
Ttelmah Guest
|
|
Posted: Tue Feb 06, 2007 9:34 am |
|
|
You are always better having a separate hardware UART. The problems wth the software UART, are that nothing else must really occur during either transmission or reception of a character, there is no buffering, and you must ensure that the code checks the incoming line wthin less than half a bit time of the character beginning.
Another alternative, is an external SPI UART.
Best Wishes |
|
|
Donlaser
Joined: 17 Sep 2005 Posts: 12 Location: Trenque Lauquen, Argentina
|
|
Posted: Tue Feb 06, 2007 11:50 am |
|
|
Ttelmah wrote: | you must ensure that the code checks the incoming line wthin less than half a bit time of the character beginning.
Another alternative, is an external SPI UART.
Best Wishes |
As Ttelmah say, you need check incoming line wthin less than half a bit time of the character beginning.
When need 2 UARTS, i use interrupt driven SW UART to do this in efficient manner.
I use incoming line in INT/RB0 in a pic 16f628a, and trigger a getc() using the interrupt.
Its works for me.
Hernan Guerrero. |
|
|
|