Shop OBEX P1 Docs P2 Docs Learn Events
Programming multiple files or cogs using PICoPLC Compiler — Parallax Forums

Programming multiple files or cogs using PICoPLC Compiler

bsnutbsnut Posts: 521
edited 2011-02-18 22:28 in Propeller 1
I like this software, because I can program some PIC's and the Propeller in ladder logic, since I started with my ladder logic programming with Allen Bradley PLC's 10 years ago. I was wondering if anyone has programmed the Propeller with PICoPLC compiler using multiple files or cogs and I, do understand that the compiler converts the ladder logic to a .hex or .spin file? Here is what it states from the Help file.
Using PICoPLC, you can draw a ladder diagram for your program. You can
simulate the logic in real time on your PC. Then when you are convinced
that it is correct you can assign pins on the microcontroller to the
program inputs and outputs. Once you have assigned the pins, you can
compile PIC or Propeller code for your program. The compiler output is a
.hex or .spin file that you can program into your microcontroller using
any PIC/Propeller programmer. Certain MCUs are supported with built in
programmer support.

PICoPLC is designed to be somewhat similar to most commercial PLC
programming systems. There are some exceptions, and a lot of things
aren't standard in industry anyways. Carefully read the description
of each instruction, even if it looks familiar. This document assumes
basic knowledge of ladder logic and of the structure of PLC software
(the execution cycle: read inputs, compute, write outputs).


ADDITIONAL TARGETS
==================

It is also possible to generate ANSI C code. You could use this with any
processor for which you have a C compiler, but you are responsible for
supplying the runtime. That means that PICoPLC just generates source
for a function PlcCycle(). You are responsible for calling PlcCycle
every cycle time, and you are responsible for implementing all the I/O
(read/write digital input, etc.) functions that the PlcCycle() calls. See
the comments in the generated source for more details.

Finally, PICoPLC can generate processor-independent bytecode for a
virtual machine designed to run ladder logic code.
My idea was to do is use the following instruction to start another cog.
> USER ROUTINE {USER ROUTINE}
--{ filename }--

The user routine allows execution of a PICoASM file. The file is loaded
and compiled on the fly. That means no placement time check is done for
the code in any means. The syntax check and compilation of the PICoASM code
is done during regular compilation (e.g. compiling or simulation)
The user routine is executed regardless of its rung-in condition. This
Allows the user to create special processing routines. For the PICoASM
syntax please check the documentation.
Any of your ideas are welcome.

Comments

  • bsnutbsnut Posts: 521
    edited 2011-02-13 10:03
    Bill,
    Thanks for replying. But, I have seen that thread before and no answers to your question or mine.

    My goal for what I want to do was to use the User Routine function to run other .picoplc files or use the function to start another spin file. And I do understand that the PICOPLC is making the Propeller act like a real PLC.

    The main part of my goal is to save typing, which makes it easier for files that are used over and over. I also wanted to see if any body had success with doing what I want to do.
  • bsnutbsnut Posts: 521
    edited 2011-02-18 22:28
    Bill and everyone else,
    Thanks for replying. I was able the compile an simple ladder program to a spin file and I'm still working on the User Routine function to see if it starts another cog. I will post my finding later on in another post.
Sign In or Register to comment.