<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Ticket search results</title><link>https://forge.codesys.com/lib/counit/tickets/</link><description>You searched for assigned_to:"aliazzz"</description><language>en</language><lastBuildDate>Sat, 10 Dec 2022 18:49:10 -0000</lastBuildDate><item><title>AssertResults array not checked for upper bounds</title><link>https://forge.codesys.com/lib/counit/tickets/58/</link><description>I use the CfUnit testframework (not yet CoUnit) and run loop over indexed test cases with TRY, CATCH on the testee FB. At some point of time, exception occured and it was showing the method AssAssertResult as the culprit for exception - RTS_ACCESS_VIOLATION. 

I suspect if it could be a phenomenon when the number of asserts per testsuite exceed 1000 (MaxNumberOfAssertsForEachTestSuite). 
I have attached screenshots of code snippets. Please verify if it could be the cause of exception and would be glad to hear from you.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">srigan1986</dc:creator><pubDate>Sat, 10 Dec 2022 18:49:10 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/58/</guid></item><item><title>Move Ticket #38 to Tickets &gt; Admin - Tickets &gt; Options &gt; Help text to display on ticket list pages</title><link>https://forge.codesys.com/lib/counit/tickets/47/</link><description>Info in Ticket #38 might be more visible if moved to  Tickets &gt; Admin - Tickets &gt; Options &gt; Help text to display on ticket list pages
At least, something helpful there linking to the important info on posting</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">i-campbell</dc:creator><pubDate>Fri, 12 Jun 2020 17:20:23 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/47/</guid></item><item><title>Tutorial example not working as expected</title><link>https://forge.codesys.com/lib/counit/tickets/46/</link><description>I updated to latest RC version 1.0.9.94

After updating my lib in my project from version 1.0.0.0 the Variable NumberOfTests of my instance of FB_Sum_Test is always 0..

I have exactly the same setting as it is described in the tutorial with the FB_Sum..</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">lukasstelzer</dc:creator><pubDate>Sat, 11 Jul 2020 08:55:56 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/46/</guid></item><item><title>add a contribution.md</title><link>https://forge.codesys.com/lib/counit/tickets/45/</link><description>*This is a first draft for review, please submit any feedback =) *

# Contributing to CfUnit
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:

Reporting a bug
Discussing the current state of the code
Submitting a fix
Proposing new features
Becoming a maintainer

## We Develop with CODESYS Forge
We use CODESYS Forge to host code, to track issues &amp; feature requests. 
Since CODESYS IDE is currently only using SVN, Pull Requests (PR's) are a bit of an issue currently.

Every code should be checked before submission:

- Does your code have a test in the verifier?
  - No =&gt; write a test for the verifier
  - Yes =&gt; provide proof that your code and test works
- After peer review and a working unittest in the verifier is provided, the code is eligible for merge in the trunk.

## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. 
Feel free to contact the maintainers if that's a concern.

## Report bugs using Codeys Forge [Tickets]
We use Tickets to track public bugs. Report a bug by [opening a new ticket](https://forge.codesys.com/prj/cfunit/tickets/new); it's that easy!

## Write bug reports with detail, background, and sample code

**Great Bug Reports** tend to have:

- A quick summary and/or background
- Steps to reproduce
  - Be specific!
  - Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

## Use a Consistent Coding Style
* Never open/edit the trunk code! Instead, create a (local) branch under your own name and make your code adjustmensts there.
* Make sure to keep the library settings and project information as the trunk project, except your version number. 
* Make sure that your CODESYS IDE uses spaces instead of tabs. The default behaviour of the CODESYS IDE is to use tabs so it needs to be changed. See Tools - Options - Text Editor - Editing - Untick "Keep tabs" and set tabwidth to 4 

## License
By contributing, you agree that your contributions will be licensed under its MIT License.

## References
This document was adapted from briandk's excellent [contribution guidelines template](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Mon, 15 Jun 2020 22:09:14 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/45/</guid></item><item><title>See also Ticket #43 TEST_FINISHED_NAMED sets finished flag and immediately clears it</title><link>https://forge.codesys.com/lib/counit/tickets/44/</link><description>FB_TestSuite.SetTestFinished should be:

IF NumberOfTests &gt; 0 THEN
    FOR IteratorCounter := 1 TO NumberOfTests BY 1 DO
        IF Tests[IteratorCounter].GetName() = TestName THEN
            Tests[IteratorCounter].SetFinished();
			SetTestFinished := TRUE;
			**RETURN;**
        END_IF
    SetTestFinished := FALSE;
    END_FOR
END_IF

if not for the return, the method resets the flag immediately after setting it. It might also clear other set flags.


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">maoravni</dc:creator><pubDate>Sat, 11 Jul 2020 08:56:08 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/44/</guid></item><item><title>See Also Ticket #44 - Testsuite with more than one multi-cycle tests won't finish</title><link>https://forge.codesys.com/lib/counit/tickets/43/</link><description>I've starting to create UT for some refactoring I'm doing in our project.

I have two UT that are multi-cycle as they need to check timed behavior, and several UT that are single cycle.

When a single one of them runs the suite finishes correctly. When both of them are running the suite never finishes.

Tried to place them at different FBs, but same result.

In the archive you'll find them both at different FBs. The two tests are TestMaxActivation and TestOneShotActivation.

Use IPC_UnitTest.

</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">maoravni</dc:creator><pubDate>Sat, 11 Jul 2020 08:56:20 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/43/</guid></item><item><title>testresults.xml top level failure count not accurate</title><link>https://forge.codesys.com/lib/counit/tickets/37/</link><description>On running multi-cycle tests the top level failure count is not accurate.

I've attached reports. The one I induced a failure on a single cycle test. Both have a failure in a multi-cycle test

~~~
&lt;testsuites disabled="" failures="1" tests="65"&gt;
&lt;testsuite id="0" name="CODESYS_Control_Win_V3.UnitTest.UnitTests.utThreePhaseExt_InLimits" tests="12" failures="1"&gt;
&lt;testcase name="T000_Default_PassAll" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utThreePhaseExt_InLimits" status="FAIL"&gt;
&lt;failure message="stTestData.xB &lt;&gt; stTestData.tpd.xB" type="BOOL"/&gt;
&lt;/testcase&gt;
...
...
&lt;testsuite id="11" name="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" tests="9" failures="1"&gt;
&lt;testcase name="T001_Invalid:0" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T001_Invalid:1" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T001_Invalid:2" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T001_Invalid:3" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T001_Invalid:4" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T001_Invalid:5" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T001_Invalid:6" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;testcase name="T002_Results" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="FAIL"&gt;
&lt;failure message="ix002: 0 res002[ix002].ixData : expected: 1 got: 0" type="INT"/&gt;
&lt;/testcase&gt;
&lt;testcase name="T003_QueryLength" classname="CODESYS_Control_Win_V3.UnitTest.UnitTests.utFB_QMachineModel" status="PASS"/&gt;
&lt;/testsuite&gt;
&lt;/testsuites&gt;
~~~

total failures should be 2 in the pasted parts of the report.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jtebokkel</dc:creator><pubDate>Mon, 04 May 2020 19:30:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/37/</guid></item><item><title>Multi-cycle TestSuite not able to finish</title><link>https://forge.codesys.com/lib/counit/tickets/36/</link><description>1. Bug Present as of this commit: https://forge.codesys.com/svn/prj,cfunit,code@362

When running tests that take multiple cycles to complete the test runner stops early. If there is more than one test suite in the project. For instance i have an SQL block I'm testing that takes several calls before it returns results.

Tracked down the source of the bug to ```FB_CfUnitRunner.RunTestSuiteTests``` see the attached diff for the fix.

</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jtebokkel</dc:creator><pubDate>Mon, 04 May 2020 19:29:58 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/36/</guid></item><item><title>Property "Placeholder" should be set to "CfUnit"</title><link>https://forge.codesys.com/lib/counit/tickets/35/</link><description>I think the errors with CfUnit in my library, are because there is no placeholder set in the cfunit.library as described in https://help.codesys.com/webapp/checklist;product=LibDevSummary;version=3.5.15.0
10:11
Property "Placeholder" should be set to "CfUnit"</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/35/</guid></item><item><title>CmpLog generates errors in standard log, it won't show the CfUnit Log</title><link>https://forge.codesys.com/lib/counit/tickets/33/</link><description>Sometimes, but not always the following message shows up in the Device Log.
It severly hampers usage of the CfUnit testing Framework as we cannot look at the CfUnit Log.

~~~
&lt;Entry severity="error" component="CmpSupervisor" user="nobody" timestamp="30-12-2019 12:30:53" infoId="0"&gt;Description=Scheduler Tick&lt;/Entry&gt;
&lt;Entry severity="error" component="CmpSupervisor" user="nobody" timestamp="30-12-2019 12:30:53" infoId="0"&gt;[2] Operation: CmpID=0x00000019, ID=0x1, enable=1, alive=0, timeout=10000 [FAILED]
~~~
Why can't we display the CfUnit Log anymore?
Find out root cause,
Suggest fix,
Implement fix.




</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/33/</guid></item><item><title>Find or create a Codesys solution for: FB_FormatString</title><link>https://forge.codesys.com/lib/counit/tickets/26/</link><description>This function block can be used for converting up to 10 arguments (similar to fprintf) into a string and formatting them according to the format specification. Formatting occurs in the same PLC cycle, i.e. the output string is available immediately after the FB was called.

~~~
VAR_INPUT
    sFormat   : T_MaxString;
    arg1      : T_Arg;
    arg2      : T_Arg;
    arg3      : T_Arg;
    arg4      : T_Arg;
    arg5      : T_Arg;
    arg6      : T_Arg;
    arg7      : T_Arg;
    arg8      : T_Arg;
    arg9      : T_Arg;
    arg10     : T_Arg;
END_VAR
~~~

sFormat: Format specification as string (type: T_MaxString)( e.g. '%+20.5f' or 'Measure X: %+..10d, Y: %+..10d' ).

arg1 to arg10: Arguments to be formatted (type: T_Arg). The following auxiliary functions can be used for converting different types of PLC variables into the required data type T_Arg: F_BYTE, F_WORD, F_DWORD, F_LWORD, F_SINT, F_INT, F_DINT, F_LINT, F_USINT, F_UINT, F_UDINT, F_ULINT, F_STRING, F_REAL, F_LREAL.

~~~
VAR_OUTPUT
    bError : BOOL;
    nErrId : UDINT;
    sOut   : T_MaxString;
END_VAR
~~~

bError: This output is set if an error occurs during formatting.

nErrId: Returns the format error code if the bError output is set.

sOut: If successful, this output returns the formatted output string (type: T_MaxString)

Example:

~~~
PROGRAM MAIN
VAR
    fbFormat   : FB_FormatString;
    iY         : DINT;
    iX         : DINT;
    bError     : BOOL;
    nErrID     : UDINT;
    sOut       : T_MaxString;
END_VAR

iX := iX + 1;
iY := iY + 1;
fbFormat( sFormat := 'Measure X: %+.10d, Y: %+.10d', arg1 := F_DINT( iX ), arg2 := F_DINT( iY ), sOut =&gt; sOut, bError =&gt; bError, nErrID =&gt; nErrID );
~~~

The result:

`sOut = 'Measure X: +0000000130, Y: +0000000130'`


For more details see
https://infosys.beckhoff.com/english.php?content=../content/1033/tcplclib_tc2_utilities/9007199289731211.html&amp;id=4735384626923042142</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Mon, 29 Jul 2019 16:33:29 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/26/</guid></item><item><title>add messages to LOG asynchronously</title><link>https://forge.codesys.com/lib/counit/tickets/24/</link><description>Currently all Log messages get published in the buffer after the code is ready running. This is IMHO no good. 
It looks like the log is in a blocking state and when it gets unblocked the entire buffer gets written (?)
We should investigate if there is a solution to push messages to the log asynchronously.

Anyway, help wanted on this as there are many possibilities on what the problem might be.
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Sun, 28 Jul 2019 09:51:28 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/24/</guid></item><item><title>Enum which can be used in LogStr</title><link>https://forge.codesys.com/lib/counit/tickets/23/</link><description>The enum should hold the following CtrlMask values;
NONE: 16#0
INFO: 16#1
WARNING: 16#2
ERROR: 16#4
EXCEPTION: 16#8
DEBUG: 16#10
USER_NOTIFY: 16#10000
ALL: 16#FFFFFFFF

Furthermore, the LogStr argument CtrlMask cannot be rewritten, so calling it will look like: LogStr( INT_TO_DWORD(enum), '...', '...' );</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Sun, 28 Jul 2019 09:50:37 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/23/</guid></item><item><title>optimization of Global Constants into a Parameter List</title><link>https://forge.codesys.com/lib/counit/tickets/22/</link><description>Exchange the global constant list for a parameter list
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Sun, 14 Jul 2019 19:57:28 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/22/</guid></item><item><title>Which codesys compiler/libraries are required at minimum to achieve maximum backward compatibilty</title><link>https://forge.codesys.com/lib/counit/tickets/20/</link><description>We should check which library versions / codesys compiler is at minimum required. This to realise a maximum backward compatibilty while maintaining stability. I.e. the library should work 100% correct at this minimum version.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/20/</guid></item><item><title>Create a solution for: Log messages get truncated when longer then 127 chars</title><link>https://forge.codesys.com/lib/counit/tickets/19/</link><description>See ticket 18 for ticket information;

Several workarounds;
1) Split the message over several log messages,
2) Add a own written logger,
3) Use an ElementCollectionList.

Currently implementing option 2</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/19/</guid></item><item><title>DeviceLog messages appears to be truncated?</title><link>https://forge.codesys.com/lib/counit/tickets/18/</link><description>It appears that the DeviceLog message output is truncated. This means that the assert messages get truncated and so import information about which assert failed will not appear.

It seems at least some characters from the message get dropped by the devicelog. 
The message itself is correct as it is sent to the device log and the debug log from within the same function;


Device Log()
[[img src=https://forge.codesys.com/prj/cfunit/code/HEAD/tree/trunk/Tickets/DeviceLog%20Message.png?format=raw width=100%]]

Debug Log()
[[img src=https://forge.codesys.com/prj/cfunit/code/HEAD/tree/trunk/Tickets/DebugLog%20Message.png?format=raw width=100%]]
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/18/</guid></item><item><title>cleaning-up of the current source code</title><link>https://forge.codesys.com/lib/counit/tickets/16/</link><description>Basic cleanup of the current source code.

Goal is clean ALL references to TwinCAT/Beckhoff/ADS to a point where the code is 100% manufacturer independent without regression.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/16/</guid></item><item><title>enable Library Documentation Scripting (sphinx)</title><link>https://forge.codesys.com/lib/counit/tickets/14/</link><description>* Self describing library documentation and export it as .chm for use in .Package</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:43:32 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/14/</guid></item><item><title>rewrite unit selftest software</title><link>https://forge.codesys.com/lib/counit/tickets/13/</link><description></description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:42:48 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/13/</guid></item><item><title>Find or create a Codesys solution for: F_ToLCase</title><link>https://forge.codesys.com/lib/counit/tickets/12/</link><description>The F_ToLCase function converts a specified string to lowercase

VAR_INPUT

~~~
VAR_INPUT
        in      : T_MaxString;
END_VAR
~~~

in: String to be converted.

Example:

~~~
PROGRAM MAIN
VAR
        sLCase : STRING;
END_VAR


sLCase := F_ToLCase( 'TO LOWER CASE 1234567890 ÄÖÜß' );

The result is: 'to lower case 1234567890 äöüß'
~~~

 

GLOBAL_SBCS_TABLE := eSBCS_CentralEuropean;
sLCase := F_ToLCase( 'TO LOWER CASE 1234567890 ĄĘŚĆŻŹŁÓ' );

The result is: 'to lower case 1234567890 ąęśćżźłó'</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:42:48 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/12/</guid></item><item><title> Find or create a Codesys solution for: FUNCTION F_RTrim</title><link>https://forge.codesys.com/lib/counit/tickets/11/</link><description>Truncates all trailing spaces from the specified value and returns the result.
FUNCTION F_RTrim: T_MaxString
VAR_INPUT

~~~
VAR_INPUT
    in : T_MaxString;
END_VAR
~~~

in: The string to be converted (Type: T_MaxString).

Example:

~~~
PROGRAM MAIN
VAR
    sRTrim  : STRING;
    sLRTrim : STRING;
END_VAR

sRTrim := F_RTrim(' trim&gt; ');(* result: ' trim&gt;' *)
sRTrim := F_RTrim('trim&gt; ');(* result: 'trim&gt;' *)
sRTrim := F_RTrim('trim&gt;');(* result: 'trim&gt;' *)
sRTrim := F_RTrim('');(* result: '' *)

sLRTrim := F_RTrim( F_LTrim( ' &lt;trim&gt; '));(* result: '&lt;trim&gt;' *)
~~~</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:42:48 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/11/</guid></item><item><title>Find or create a Codesys solution for: FUNCTION F_LTrim</title><link>https://forge.codesys.com/lib/counit/tickets/10/</link><description>https://infosys.beckhoff.com/english.php?content=../content/1033/tcplclib_tc2_utilities/18014398544608779.html&amp;id=

Removes leading spaces from the character string and returns the reduced character string.
FUNCTION F_LTrim: T_MaxString
VAR_INPUT

&gt; VAR_INPUT
&gt;     in  : T_MaxString;
&gt; END_VAR

in: The string to be converted (Type:T_MaxString).

Example:

~~~
PROGRAM MAIN
VAR
    sLTrim : STRING;
END_VAR

sLTrim := F_LTrim(' &lt;trim ');(* result: '&lt;trim ' *)
sLTrim := F_LTrim(' &lt;trim');(* result: '&lt;trim' *)
sLTrim := F_LTrim('&lt;trim');(* result: '&lt;trim' *)
sLTrim := F_LTrim('');(* result: '' *)
~~~</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:42:48 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/10/</guid></item><item><title>Find or create a Codesys solution for: DWORD_TO_HEXSTR</title><link>https://forge.codesys.com/lib/counit/tickets/6/</link><description>This function converts a decimal number into a hexadecimal string (base 16).
~~~
FUNCTION DWORD_TO_HEXSTR : T_MaxString

VAR_INPUT
        in              : DWORD;
        iPrecision      : INT;
        bLoCase         : BOOL;
END_VAR
~~~

in: The decimal number requiring conversion.

iPrecision: Minimum number of displayed digits (digits). If the actual number of significant digits is less than the iPrecision parameter, the resulting string is filled with zeros from the left. If the number of significant digits is greater than the iPrecision parameter, the resulting string is not cut off! If the iPrecision parameter and the in parameter are zero, the resulting string is empty.

bLoCase: This parameter determines whether lower or upper case letters are used in the conversion. FALSE =&gt; "ABCDEF", TRUE =&gt; "abcdef".

 

Example in ST:

~~~
PROGRAM MAIN
VAR
        s1      : STRING;
        s2      : STRING;
        s3      : STRING;
        s4      : STRING;
        nCnt    : WORD;
END_VAR

nCnt := 43981;
s1 := DWORD_TO_HEXSTR( nCnt, 1, FALSE );
s2 := DWORD_TO_HEXSTR( nCnt, 1, TRUE );
nCnt := 15;
s3 := DWORD_TO_HEXSTR(  nCnt, 4, FALSE );
nCnt := 0;
s4 := DWORD_TO_HEXSTR( nCnt, 0, FALSE );
~~~

The result:

s1 = 'ABCD'

s2 = 'abcd'

s3 = '000F'

s4 = ''</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:42:48 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/6/</guid></item><item><title>Find or create a Codesys solution for: PlcTaskSystemInfo</title><link>https://forge.codesys.com/lib/counit/tickets/3/</link><description>Create/exchange the following datastucture with something more vanilla Codesys;

Each PLC contains an array of instances of this type. The name of the arrays is '_TaskInfo[]'.

The individual instances of this type can be accessed by using the index of the corresponding task as array index. The task index can be read via the function block GETCURTASKINDEX, which is provided by the Tc2_System library.

The corresponding namespace is 'TwinCAT_SystemInfoVarList'. This must be specified for use in a library, for example.

~~~
{attribute 'Namespace' := 'PLC'}
TYPE PlcTaskSystemInfo
STRUCT
     ObjId                   : OTCID;
     CycleTime               : UDINT;
     Priority                : UINT;
     AdsPort                 : UINT;
     CycleCount              : UDINT;
     DcTaskTime              : LINT;
     LastExecTime            : UDINT;
     FirstCycle              : BOOL; 
     CycleTimeExceeded       : BOOL; 
     InCallAfterOutputUpdate : BOOL; 
     RTViolation             : BOOL;

     TaskName                : STRING(63);
END_STRUCT
END_TYPE 
~~~

ObjId   = Object ID of the task reference, from which the PLC program is called.
CycleTime   = Set task cycle time in multiples of 100 ns
Priority   = Set task priority
AdsPort   = ADS port of the task
CycleCount   = Cycle counter
DcTaskTime   = Distributed clock system time. It remains constant for a task runtime.
LastExecTime   = Cycle time required for the last cycle in multiples of 100 ns.
FirstCycle   = During the first PLC task cycle, this variable has the value TRUE.
CycleTimeExceeded   = This variable indicates whether the set task cycle time was exceeded.
InCallAfterOutputUpdate   = This variable has the value TRUE if the origin of the current call is declared with the attribute 'TcCallAfterOutputUpdate'.
RTViolation   = This variable has the value TRUE if the real-time limit is exceeded on a mixed core (Windows + real-time on one core). In this case the value TRUE refers to the core on which the corresponding task is running.
TaskName   = Name of the task

Example:

~~~
VAR
     fbGetCurTaskIdx  : GETCURTASKINDEX;
     nCycleTime       : UDINT;
END_VAR

fbGetCurTaskIdx();
nCycleTime := _TaskInfo[fbGetCurTaskIdx.index].CycleTime;
~~~</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aliazzz</dc:creator><pubDate>Fri, 01 May 2020 09:42:48 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/3/</guid></item></channel></rss>