The Brazilian students are at it again. First Blockly to BASIC, and now Ladder Logic to BASIC. Ladder Logic which is still used in control systems, is probably among the first graphical languages. Thanks to Leonardo, one of Miguel's students at Universidade Regional de Blumenau.

Pictured here is a binary counter in LadderLogic.

And here is a portion of the BASIC output. It covers the main loop, initialization and one of the rungs. Kind of reminds me of an Arduino Sketch.

sub Rung003
  dim _S0 as integer
  _S0 = 1
  Q05 = (T1AC AND 16.0)
  Q06 = (T1AC AND 32.0)
  Q07 = (T1AC AND 64.0)
  Q08 = (T1AC AND 128.0)
endsub

sub InitContext
  T1EN = 0
  T1AC = 0
  T1PRE = 256
  T1B = 100000
  T1DN = 0
  T1TT_L = __VAR_TIME_L__
  T1TT_H = __VAR_TIME_H__
endsub

main:

  __init()
  InitContext()
  while (1)
    __input()
    __update()
    Rung001()
    Rung002()
    Rung003()
    __output()
  loop

Next Post Previous Post

  0