General > Technical support

goto command

<< < (2/2)

garysdickinson:
Pete,

it sounds like you are working on a fairly complex problem.

As you have figured out the TBASIC language does not have any sort of computed GOTO or computed CALL functionality.  So your choices are to either make the computed CALL using a CF or to do it in ladder logic.

I am guessing that your code is using the variable SeqNo to make decisions.  Most of my  non-trivial  PLC  programs work in this manner. 

The PLCs allow you to use COUNTERs 1..8 as "sequencers". The Present Value of these Sequencer/Counters can be tested in ladder logic and the Preset Values can be changed in ladder logic.  When used as Sequencers you are limited to the values of 0..31.

I use this mechanism for many reasons:

* Ladder logic is faster than TBASIC in making these decisions
* The SeqNo is visible for debug both in simulation and on-line monitoring.
* The SeqNo can be changed during debug to force code to run. for debug.
* it provides a method to support multiple threads of operation. Poor-man's multitasking.
This approach scares most PLC programmers because it sounds too complex.

If you are interested, I have posted many examples of this sort of approach.  I’d be happy explain how it works.

Gary d

uknanoman:
Hi Gary
          Thanks for the response and the offer of help. The system I am working on at the moment is perhaps more busy than complex. And yes I am using the SeqNo as you described and I
am using CF's within which, the last operation of the CF is to update the SeqNo to point to the next appropriate CF, which would be the next operation of the control system. The upshot of all
of this is that I have CFs simply named as Step_01 ~ Step_40 which allows me to quickly locate the Tbasic within that step.  As you rightly mentioned about the inbuilt sequencers, I have used them before on an older version of the same control system using a nano+external HMI. However with this new project I am using a WX100 and because I am introducing new functionality and controlling the inbuilt display at the same time it seemed prudent to incorporate display and control within each CF. So far it is working ok but i did not know that Ladder Logic is faster than Tbasic in making decisions! I shall keep this in mind for future projects where speed is essential. FYI The Current project is a Cement Silo Filling control system, As I said before I have 4 of these working already and this is a sort of replacement / update version for hardware as well as software. The system strictly regulates the filling procedure and tracks the operators procedure doing prechecks and testing of system functionality before during and after the filling. It uses modbus to communicate with a weigh system for silo contents and a remote i/o block at the top of the silo for interfacing to analogue and digital sensors. The system logs events into an event log and sends e-mails on our LAN. One thing I missed on the WX100 is the ethernet port and so I have used a Cheap MANGO wireless Router( less than £20.00) to give me back that facility, so now I have the best of both worlds so that the unit is physically connected by ethernet cable to our LAN for e-mails, spreadsheet interfacing, and remote programming from the office, but for onsite local mods (at the control system) I now don't have to plug my laptop in anymore as I connect by the WIFI.  When I finish the new project unit I will probably upload it to this site as a customer project for viewing the superb capabilities of the TRiPlc products.
Anyway I appreciate you interest and offer of help so I may come to you at some future point or feel free to comment on any of my future posts.
All the Best Peter             

Navigation

[0] Message Index

[*] Previous page

Go to full version