Parallel to Serial

Discussion in 'The Projects Forum' started by FrozenMel, Sep 29, 2011.

  1. FrozenMel

    Thread Starter Member

    Aug 23, 2011

    I am working on a project that requires feedback from 60 different relays. All the signal from the relay tells me is whether or not it switched so the output is 3.3V or 0V. Basic digital 1 or 0. The problem that I am having is that the microprocessor that I am using will not accept 60 different digital inputs. I'm not even sure if one such processor exists.

    Is there a simple way to cut down the number of inputs? Like a giant PISO shift register? I would prefer the output to be something a few digital I/O pins could read or RS-485. RS-422 is also a possibility but I would prefer not to use it.

    Thanks in advance.
  2. Georacer


    Nov 25, 2009
    You could google polling. You can multiplex all of the inputs with some MUXs and check each one for a very short time. With a uC this should be very easy.
  3. oldtech33709

    New Member

    Sep 24, 2011
    four 16 bit parallel to serial shift registers. 4 ports? (and 4 spare bits).
  4. John P

    AAC Fanatic!

    Oct 14, 2008
    Or 8 8-bit parallel to serial chips, like the 74HC165. At the processor, you'd just need a clock, a strobe, and a single data in line.

    It would helpful if you used a processor with an SPI port, but you could bit-bang it.
  5. FrozenMel

    Thread Starter Member

    Aug 23, 2011
    I'm using a rabbit BL2500 with the OEM2500 expansion on it as my main controller/processor. It just gathers and resends the data over IP but it does have 2 serial expansion SPI RS-422 ports. I just don't really know how those work because all the info i can get on them is that they are "Rabbitnet" ports... If anyone knows what those ports can do or what their pinouts are that would be great. If i can use it as a standard SPI port that would be amazing.
  6. AlexR

    Well-Known Member

    Jan 16, 2008
    You could use a microcontroller and some 16 bit port expanders (MCP23017/MCP23S17). They come with either I2C or SPI interfaces and up to 8 chips can be connected to a single bus.
    These port expanders support an interrupt on change function with interrupt outputs that can be wired back to the external interrupt input of the microcontroller. Using the expanders this way would reduce any need to poll individual ports or pins.
  7. FrozenMel

    Thread Starter Member

    Aug 23, 2011
    Wouldn't you need the clock, strobe (i assume that's a shift enable) and a dataline for each of the 8 PISO chips? Or can you cascade the outputs into the serial inputs of another chip? And then, how would you control when the cascaded chips shift the serial input instead of the parallel input so you didn't overwrite the data and you end up with a 64 bit long serial signal at the end of the cascade?

    Would you just write from the parallel inputs on all the chips at once and then just shift through the cascaded chips?
  8. SgtWookie


    Jul 17, 2007
    Connect all PL's (pin 1) together, and to a uC pin that is configured as an output.
    Connect all clock enables (pin 15) to GND.
    Connect Q7 (pin 9) to the next IC's Ds (pin 10), the last Q7 to a uC pin that is configured as an input.
    Connect all clock pins (pin 2) together, and to a uC pin that is configured as an output.

    1) Place a logic low on the PL's to load the state of the relays.
    2) Raise the PL's to save the state.
    3) Read Q7's state (pin 10) via the input pin, save it.
    4) Clock the pin 2's by placing a rising edge on the connected I/O pin; return it to low afterwards.
    5) Repeat from step 3 until the state of all 60 relays read.

    Note that each IC will need a 0.1uF/100nF bypass cap across it's supply pins.