Tips - Error-Free Connections with Named Wires | サイプレス セミコンダクタ
Tips - Error-Free Connections with Named Wires
In a recent blog I talked about wiring tips for faster design. One of the risks with being a wire-drawing wizard, though, is that it can lead to a bit of a messy schematic. It is tempting to just drop in your components anywhere on the page and hook them up. If you ever look at an old design and wonder what you were thinking about at the time then I recommend naming your wires.
PSoC Creator resolves wires with the same name into a single signal path when it builds a project and so two (or more) wires with the same name are functionally equivalent to a single wire with fourteen elbows meandering around a cluster of components.
Here is a design I made recently that uses a PWM with two outputs to drive a reflectance sensor. The first output (pwm1) turns the LED on briefly and the second (pwm2) triggers the D flip-flop to read the state of the pin a little while later. The reflectiveness of the surface determines how long the transistor takes to decay and so the output of the flip-flop is always a snapshot of the state of the sensor. In firmware, I read the status register and can make decisions based on the surface my board is lying on.
The problem is that I have five of these sensors and I wanted to drive them all from the same PWM and read them from one status register. I made copies of the pin and flip-flop and started wiring but it took quite a while. I kept making mistakes because I could not remember which wire should go where and I would inadvertently connect two wires that were driven by different signals. I managed to get three sensors working.
I was daunted by the prospect of more wiring and I was running out of room on the page! How would I ever maintain this project? So, in the end, I gave up and took the extra 30 seconds to just name the wires coming from the PWM and those going to the status register. You just right-click on the wire and choose "Edit Name and Width" to do this.
I then tidied up the design in no time. As you can see, naming the wires let me break the whole design into three pieces; the PWM, the pins and flip-flops, and the status register. I managed this without ever making a bad connection and it is much easier to see the connectivity when there are not wires running around and crossing each other.
Taking a few seconds to name wires can save you a lot of time drawing your schematics. Not only can you make designs (that work) quickly but you can do so in a way that is far easier for other engineers to understand. In a future blog I will expand on that idea with some more tips on making schematics with lots of repeated content, like all these pins and flip-flops, even easier to read and maintain.