The PRINT #3 function is then used to send the ASCII string out of its RS485 port (comm port #3).Įvery 0.1s, read data from MODBUS Slave ID=05, divide the data by 3 and add 10, then write the modifed data to MODBUS slave ID = 09. It then performs math and string operations to convert the reading into ASCII string that can range from "0.00V" to "5.00V". Custom Function Fn_#1 uses built-in ADC(1) command to read ADC signal, which returns a value between 0 - 4096.
This is also very easily accomplished with Ladder+BASIC. The "SETLCD" command is used to display the data and text on the LCD.Įvery 0.5s, measure the signal at Analog Input #1 and then format the reading into ASCII string as "x.xx V" and send out to the RS485 port. The moment a pulse frequency measurement channel is enabled by the "PMON" command, you can use the built-in "PULSEFREQUENCY(1)" command to obtain the frequency value in Hz. The content of Fn_#1 is displayed to the right. The ladder rung uses a built-in "clock pulse" to trigger the function #1 every 0.2s. This is unbelievably easy to achieve with Ladder+BASIC language! As you can see below, the whole program comprises just one ladder logic rung and one custom function: Otherwise, the PLC will happily execute standard ladder logic circuit based on AND, OR, NOT, timers, counters only!Ĭreate your own Digital Tachometer: Monitor the frequency of incoming pulses and display the reading on an LCD display Note: You only need to use the BASIC language as and when needed as demonstrated in the above case.
The Custom Function #10 is "differentiated" (aka "one-shot") type which means that it will execute only once when triggeredĢ) Next, edit the custom function #10 and enter the following TBASIC program code:
In Circuit #2, both the "Run" bit and "Greetings" input must be closed to trigger the Custom Function #10. The "Run" output will only be turned OFF when the NC "Stop" input is energized. Note: Circuit #1 shown below is a standard ladder "seal" circuit which turns on the output "Run" whenever the input "Start" is closed momentarily. Say when you press a button, your PLC will greet you either "Good Morning", "Good Afternoon" or "Good Evening" on its LCD display depending on the time of the day.ġ) Create a ladder logic circuit, with an input contact named "Greetings", and use it to trigger a custom function #10 when the button connected to this input is pressed.
#Starting your first ladder logic program simulator#
We have also developed a family of M-series Super PLCs that are exclusively programmed in Ladder + BASIC language, using our highly acclaimed TRiLOGI PLC programming Editor, Compiler and Simulator software. These powerful programming languages are designed for data processing, but they are not oriented towards flipping single bit digital I/Os.īy combining these two most important branches of programming languages into one single, seamless entity, we had invented the industry first "Ladder + BASIC" language that can easily handle sophisticated tasks with just a few lines of codes. On the other hand, desktop computers are typically programmed by high-level languages such as BASIC, C, PASCAL, C++, Java etc. Ladder Logic language has its strength in handling single bit digital I/O programming, but it is awkward to handle data processing where numerical data needs to be manipulated. Most PLCs in the industry are programmed by a highly specialized, well-established programming language called "Ladder Logic".