PDA

View Full Version : 4 serial inputs 1 chip



nukte
- 6th July 2009, 02:06
I am beginning a new project. I want to connect 4 Parallax RFID readers to a PIC 16F877.
I have already have the code written for one reader, but now I need to expand to 4. I know I will need to use ports other than only the internal USART.
Does anyone have an idea how I might "scan" the 4 ports, and when an input is found on one of them collect the data?
It seems like I am asking for an interrupt routine, but maybe there is some simpler method using IF, Then statements. Has anyone got an idea?
Thanks
Dan

dhouston
- 6th July 2009, 04:04
What baudrate?

Archangel
- 6th July 2009, 05:52
I am beginning a new project. I want to connect 4 Parallax RFID readers to a PIC 16F877.
I have already have the code written for one reader, but now I need to expand to 4. I know I will need to use ports other than only the internal USART.Do you have a spare MCU pin on the reader's pics? If so you could hook the readers all to the usart with a series resistor on each, then when a reader sends data it could pull that spare pin low which signals the other readers to standby, (all spare pins hooked together). Just make sure the reader's output pins Idle in the High state.

dhouston
- 6th July 2009, 11:31
The datasheet for the reader says it is 2400 bps. I would not use a PIC. The ZX-328n from ZBasic can support up to 4 software UARTS that are full duplex, buffered, and operate in the background (with 4 UARTs, the max speed is 9600) . The ZX-328n has a built-in bootloader (uses the highspeed hardware UART) and the ZBasic compiler is free. The ZX-328n costs $10. You will to add the crystal, caps and an inverter for the hardware UART but this project will be child's play using it while it will be difficult with a PIC & PBP.http://www.zbasic.net/Microcontrollers/ZX-328n-Microcontroller/p-68.html?osCsid=df28243e0d7db56b25d8b3f5ed3de9fd

nukte
- 6th July 2009, 15:26
The datasheet for the reader says it is 2400 bps. I would not use a PIC. The ZX-328n from ZBasic can support up to 4 software UARTS that are full duplex, buffered, and operate in the background (with 4 UARTs, the max speed is 9600) . The ZX-328n has a built-in bootloader (uses the highspeed hardware UART) and the ZBasic compiler is free. The ZX-328n costs $10. You will to add the crystal, caps and an inverter for the hardware UART but this project will be child's play using it while it will be difficult with a PIC & PBP.http://www.zbasic.net/Microcontrollers/ZX-328n-Microcontroller/p-68.html?osCsid=df28243e0d7db56b25d8b3f5ed3de9fd
Thanks Dave but the design must be implemented with PIC. But I will check on your chip recommendation for future designs

nukte
- 6th July 2009, 15:29
Do you have a spare MCU pin on the reader's pics? If so you could hook the readers all to the usart with a series resistor on each, then when a reader sends data it could pull that spare pin low which signals the other readers to standby, (all spare pins hooked together). Just make sure the reader's output pins Idle in the High state.

Almost perfect and a very good idea, but I don't have any pics on the reader boards, just the RS232 (MAX 232) chip. So I can only receive the card data at the PIC.

dhouston
- 6th July 2009, 15:51
Thanks Dave but the design must be implemented with PIC. But I will check on your chip recommendation for future designsThen you'll need to look at Darrel's Instant Interrupts.

Or, if you don't have to worry about simultaneous inputs, look at a DG409 and http://www.maxim-ic.com/appnotes.cfm/an_pk/588.

Archangel
- 6th July 2009, 23:58
Almost perfect and a very good idea, but I don't have any pics on the reader boards, just the RS232 (MAX 232) chip. So I can only receive the card data at the PIC.They have CTS and RTS lines that work pretty much just that way.

Archangel
- 7th July 2009, 00:00
Then you'll need to look at Darrel's Instant Interrupts.

Or, if you don't have to worry about simultaneous inputs, look at a DG409 and http://www.maxim-ic.com/appnotes.cfm/an_pk/588.That looks like his solution Dave.

nukte
- 7th July 2009, 01:16
That looks like his solution Dave.

Think that's the answer, I like having lots of control, and it's easy to know just which port will be working. Thanks to everyone (Again).
You're a great bunch and I'm proud to know you