LabView diagram for H-bridge controlWell, after wiring all the cable it's time for programming! My tools of choices for this quick jobs is LabView from National Instrument.
Setting up serial communication in LabView can be done using just 4 block, Open port, Send data, Receive data and Close port. Put everything in While-loop adds a few button and even-case and we are good to go!
My code is shown below :
Well, what the point of seeing my code? would it be nice if you can just copy + past and run above code without having to drag and drop everything yourself? Here is another thing I love about LabView, you can just copy above picture (it is .png file) then open your newly open LabView windows and drop the picture on the window, then tada~~~ there is a ready to run VI for you.
Some useful tip
Do not change direction of your motor abruptly, stop a motor first then change. This is to prevent current surge in your circuit especially when you don't have any current protection circuit like mine!
Before connect your motor to power source, it would be wise to test the H-bridge circuit first! Relay of the same side must not close (current able to pass through) at the same time, otherwise current will pass from source (say 24Volt.) directly to Ground which will burn all of your cables and relays.