Git Product home page Git Product logo

fisothemes / fisothemes-standard-library-for-twincat Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 259 KB

This library aims to consolidate, clean up, and improve the existing TwinCAT library on my GitHub profile. The goal is to provide TwinCAT developers with a clean, simple, and consistent library that enhances their development experience and helps them build projects more efficiently.

License: MIT License

beckhoff stdlib twincat3 twincat iec61131-3 industrial-automation plc-programming structured-text codesys

fisothemes-standard-library-for-twincat's Introduction

Fisothemes' Standard Library for TwinCAT

Welcome to the Fisothemes's Standard Library for TwinCAT! This library aims to consolidate, clean up, and improve the existing TwinCAT library on my GitHub profile. The goal is to provide TwinCAT developers with a clean, simple, and consistent library that enhances their development experience and helps them build projects more efficiently.

Features

  • Modularity: The library is organized into different modules, each focusing on a specific area such as core functionality, error handling, strings, numerics, collections, I/O, hashing, streams, sockets, and callbacks.
  • ๐Ÿšง Reusability: The modules will be designed to be reusable components that can be easily integrated into your TwinCAT projects.
  • ๐Ÿšง Documentation: The repository will include comprehensive documentation that guides you on how to use the library effectively and efficiently.
  • ๐Ÿšง Examples: A collection of examples will be provided to showcase the usage of different modules and help you get started quickly.
  • ๐Ÿšง Contributions: Contributions from the TwinCAT community are welcome! Please refer to the Contribution Guidelines for more information.

Getting Started

Please note that the Fisothemes's Standard Library for TwinCAT is currently under development. While it is not yet ready for full usage, I would like to provide you with a glimpse of what is planned. Here are some code snippets to give you a taste of what I have in mind:

Base Class

FsFB_Object IMPLEMENTS FsI_Object
โ”œโ”€โ”€ Methods
โ”‚   โ”œโ”€โ”€ Is(ipObject : FsI_Object) -> BOOL
โ”‚   โ””โ”€โ”€ ToString() -> FsT_LStr
โ””โ”€โ”€ Properties
    โ”œโ”€โ”€ TypeName : FsT_Str
    โ”œโ”€โ”€ InstacePath : FsT_LStr
    โ”œโ”€โ”€ Address : FsT_Ptr
    โ”œโ”€โ”€ Size : FsT_Size
    โ””โ”€โ”€ MemoryArea : FsT_MemArea

Error Class

FsFB_Error EXTENDS FsFB_Object IMPLEMENTS FsI_Error
โ””โ”€โ”€ Properties
    โ”œโ”€โ”€ Code : FsT_ErrCode
    โ””โ”€โ”€ Message : FsT_ErrMsg

Immutable String Example

Declarations:

VAR
    sValue : STRING(255);
    fbImmutStr : FsFB_ImmutableString('I love cats!');
    DogPos : FsT_Pos;
    fbErr : FsFB_Error;
END_VAR

Implementation:

sValue := fbImmutStr
    .Search('Dogs', 0, Pos => DogPos, e => fbErr)
    .ToString();
CASE fbErr.Code OF
    0: ...
ELSE
    // Handle Error.
    END_CASE

TCP Client Example

Declarations:

VAR
    SendBuffer, RecvBuffer : FsT_Str;
    fbTcpClient : FsFB_TcpClient;
    fbErr : FsFB_Error;
END_VAR

Implementation:

IF bConnect THEN
    // The Connect method returns TRUE when done irrespective of error.
    bConnect := NOT fbTcpClient.Connect('127.0.0.1', 8008, e => fbErr);
    IF fbErr.Code <> 0 THEN
        // Handle error.
	END_IF
    END_IF
	
IF bDisconnect THEN
    bDisconnect := NOT fbTcpClient.Disconnect(e => ipErr);
    END_IF
	
IF bSend THEN
    bSend := NOT fbTcpClient.Send(SendBuffer, e => ipErr);
    END_IF

IF bReceive THEN
    bReceive := NOT fbTcpClient.Receive(RecvBuffer, nBytes => nRBytes, e => ipErr);
    END_IF

License

This project is licensed under the MIT License.


Contact

If you have any questions or suggestions regarding the Fisothemes's Standard Library for TwinCAT, you can reach out to me via [email protected].

fisothemes-standard-library-for-twincat's People

Contributors

fisothemes avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.