TTI Component for the blog
We recently published a blog article which demonstrated how we implemented one of the newest features of Flowcode 6, the ability to talk to 3rd party hardware. In that article we demonstrated how Flowcode was able to talk to a PicoScope oscilloscope, and we were able to create an automated test routine for internal testing of our own hardware. In this article we want to demonstrate how we have interfaced with another piece of 3rd party equipment, a TTI Power Supply Unit (PSU) which is controlled from Flowcode via USB.
The TTI instrument used was the PL155-P PSU, a 15V-5A power supply with remote capabilities. It is possible to control the device using USB, RS232 or Ethernet (a GPIB interface is also an optional extra). We implemented the USB interface for simplicity within the lab, but plan to extend functionality to Ethernet at a later date.
In order to control the PSU from Flowcode we must connect the device over USB and ensure we send the appropriate RS232 strings to the device. The programmers guide for the PSU features a set of over 60 programming commands to control the device. Some of these range from simple commands to set the voltage and current limit of the output, to more complex commands to check for system locks or returning the value of status registers.
For each of the programming commands a separate Macro was created within Flowcode. Each of these Macros features a flowchart to create a string of characters which is sent to the device when the function is called. The format of this string of characters determines the function performed by the PSU. An example of a programming command which sets the output voltage, and the associated Flowcode Macro, are seen below;
V<n> <nrf> “Set output <n> to <nrf> volts”
Since we only have 1 output, the value <n> will always be ‘1’. The value of <nrf> is a floating point in order to be able to set voltages with a decimal point.
In order to utilise this command we therefore need to pass two parameters to the Macro, the Output and the value of the voltage that we want to set. For this particular command no return value is sent back from the PSU, therefore we do not need to configure the return parameter within the Macro.
The required flowchart to create this string of text is seen below. It can be seen that a series of calculation boxes is used to construct a string which includes the chosen argument values from the end user. It can also be seen that prior to sending the command with the ‘RS232::SendString’ command, the string is terminated with the characters “\n” to signify the end of message command.
If we proceed through the above flowchart, and use the simulation debugger tool within Flowcode we can check whether our string of characters is correctly formatted. In this example, we are setting Output 1 to a value of 2.37V.
With all 60+ macros created, we can now export the component to become a standalone item within Flowcode. This will allow us to utilise the PSU in other flowcharts much like we can with any other Flowcode Component. When exporting the component we selected all macros to allow the end user complete control over the PSU. It is at this point that we could limit the extent of the macros available if we also wanted to create a simpler program. Here we would choose undesired macros to be hidden when we exported the component.
The above created component is what we term a ‘low-level’ component, where the end user must have some specific knowledge relating to the operation of the PSU. It is ideal for creating a test routine where, for example, the user can simply create a flowchart that ramps the voltage over time. An example of this program is seen below. It can be seen that a ‘While 1’ loop is introduced, and with each loop iteration the value of count is incremented by 1. The Macro ‘V’ is used to change the voltage of the PSU depending on the value of ‘count’. Therefore the voltage will increment from 0-15V over time. An ‘If’ statement is used to reset the value of ‘count’ back to zero when it exceeds 15, the maximum operating voltage of the PSU. A small 2s delay was introduced to slow down the system and ensure that the program worked correctly. Much more complex test routines can be created with the PL155-P component, we have just provided you with a simple example.
In the second part of this blog article we want to demonstrate how you turn a ‘Low-level’ component into a ‘High-level’ component. A High-Level component allows people to wrap up one or more low level components and even offers the possibility of placing a nice GUI over the top. In Flowcode 6 this is now even easier thanks to the 3D drawing capabilities of the software.
In the diagrams below you can see how the front panel of the PSU was created to mimic that of the hardware. This component is still in development, so not all functionality has been extended to this device, but it shows the basics of what is possible.
The video below demonstrates the high-level PSU component being controlled from within Flowcode to adjust the output voltage and current limit on the hardware.
Flowcode 6 is an exciting product as it allows multiple pieces of 3rd party hardware to be connected together all within a single development environment. With our two created components (the PicoScope and PSU) we can now start to build up a test platform, where all equipment can pass information into Flowcode. This information can then be logged and used to control external equipment, such as motors, actuators or any other hardware as appropriate.
18,617 total views, 10 views today