Multiplexer Implementation on an Industrial PLC

Multiplexer Implementation on an Industrial PLC

Introduction

Those familiar with microelectronics and single board computer design will probably be aware of the concept of multiplexing, either memory or I/O. I’m going to show you how to implement multiplexing on an industrial PLC.

?

What is Multiplexing

First off, I’m going to give a short 101 to multiplexing for those unfamiliar with the concept. The technical definition of multiplexing according to the Cambridge Dictionary is; an electronic process that allows more than one electrical signal to be sent using only one connection.

For our purposes this means utilising more discrete I/O than is physically allocated to the system. I will show you a method where one byte of eight discrete inputs can be turned into sixteen or more.

Implementation

The Hardware

Consider a PLC system which has one byte of inputs and one byte of outputs. For simplicity all eight inputs are connected to push buttons. Conventionally this would be wired as something similar to this…


Convential, non multiplexed I/O

As you can see, we have capacity for 8 discrete inputs (buttons in this example). But what if we need more? Well, of course we could add an input card but, for the sake of argument, we can’t? We may have space, cost constraints etc.

This is where our multiplexer comes in. Let’s add another eight inputs to our system…


Building a multiplexer Part 1

As you can see, I have also added a second 24v supply rail. This is just for clarity, it can be fed from the same source as the original supply.

Now I know what you’re thinking; that the first block of eight buttons will be fighting against the second eight for physical space, and you would be right! So, let’s make another hardware change…


Building a multiplexor Part 2

As you can see, I have added a relay and connected it to an output on the system. Now I can switch each bank of eight buttons in and out by energising the relay.

Now onto the fun stuff!

The Software

If you follow good form and map your inputs at the start of the scan it then becomes trivial to implement the software for the multiplexer.

We first read the first eight buttons into our local I/O map…

We then switch the multiplexer relay to use the second bank of eight buttons…

?

We then read the second eight buttons into our local I/O map…


?

And lastly switch the multiplexer back…

?

?Of course there are more elegant ways of doing this. The example above is done for clarity.

Conclusion

This is obviously not the recommended solution for not having enough inputs but it is an interesting concept.

?

Things to note:

It’s best to use a solid-state relay because the controller needs to switch twice with every processor scan, so you don’t want a mechanical relay chattering away ten to the dozen!

Kinda obvious but you also want to ensure that you don’t reference the physical inputs just the copy of the input map or chaos will ensue!

It is also wise not to use this on input devices that take a while to boot or steady themselves. There are work arounds to this, like having a constant supply on the device and just multiplexing the output signals from the device. I’ll leave you figure that one out!

Lastly, you can also multiplex analogue signals and outputs but again that’s something for you to work out! If you have any neat optimisations for this then let me know!

?

Happy coding folks!

要查看或添加评论,请登录

Matthew Thorne的更多文章

  • Accessing PLC Tags From C#

    Accessing PLC Tags From C#

    So you want to access Allen Bradley (Rockwell) PLC tags for use in your own C# Projects? Read on! A long time ago I…

    4 条评论

社区洞察

其他会员也浏览了