News:

  • May 31, 2026, 03:12:51 PM

Login with username, password and session length

Recent Posts

Pages: 1 ... 5 6 [7] 8 9 10
61
Thanks for the assist and explanation of the errors. It can be hard one can't find something in the documentation that tells the user what to change to fix the issue. Am I missing some import documentation somewhere?

A couple of issues.

The Insert Instructions has 2 Import modes.  The default is to insert as rungs of logic into a specific location of an existing code block.  The other is when you have an entire code block that you want to insert (not inside an existing code block).


I had no idea you could just delete even the code block part and import it as rungs. I couldn't find that anywhere in the documentation.

The code below imports without issue with
as rungs of logic: on
Ignore Element Documentation: on
Ignore MEM_CONFIG Sections: on
Code: [Select]
// Rung eventlogger2#1
// Offset 0
STR ST1
OUT C222

The issue is the exports allow me to export without the mem config section included. Which is what I did. There was no memory config section to modify.
And the error message did not specify that I was missing said heap item definitions.
The same errors happen when I use I turn ignore mem config on.

But when I turn mem config on I then get a whole bunch of warnings and some errors because the mem config contains all of the addresses including some that were made with the ethernet/ip setup that now give the error that the name is too long despite being made in the program and never getting any error messages on it before now and the program itself functioning fine on the plc.
[Error]   why_does_this_not_import4_2.txt(495)   User Data Type Name length is too long(17); maximum length is 16 characters
why_does_this_not_import4_2.txt(495)   User Data Type Name must be 1 to 16 characters; no spaces, can contain only letters, numbers, and/or underscores, cannot start with a number; must be unique

It would be nice if the "Invalid Element Type" error message had at least some kind of hint like which part threw it off. But I get how many permutations there can be when designing error handling.

As for the error above how might I handle these errors, some don't make sense as  I have the same _ in other assembly names. What's stranger still is the name appears twice in the mem config section when no modifications were made in that section. only a simple replacement of "eventlogger2" with "event_logger4_1".

The main question now is:
How might I handle these errors? That UDT is in a bunch of places in my code. Do I need to delete most of the mem config except for the heap items and import that?

Code: [Select]
VI_On_Off_inst112
// Field Name, Data Type, Memory Layout, Read/Write, Display Format, Data View Detail
VI_On_Off_1_16_B, UWORD, 0:0, Read-Write, Native, Short
VI_On_Off_17_32B, UWORD, 0:1, Read-Write, Native, Short

mem config section:
Code: [Select]
  VIOnOffInstTwo VI_On_Off_inst112 decimal 1
 VIOnOffInstTwo VI_On_Off_inst112 decimal 1
62
A couple of issues.

The Insert Instructions has 2 Import modes.  The default is to insert as rungs of logic into a specific location of an existing code block.  The other is when you have an entire code block that you want to insert (not inside an existing code block).

Your .txt file contains a TASK code block, not just rungs of logic.  So you must choose the other option to insert As Code Blocks, which you tried.

You tried that and it failed differently.  It appears your .txt file has been modified and you are missing the memory configuration portion of the export that defines the heap item "eventlogger" and "eventlogger2".

Not sure how this was generated, but the Memroy Configuration section is missing.  This defines the areas that may need to be created in your new project that are missing (like a task heap item or a block of reals or whatever).

Here is a copy of the export I created that has that Memory Configuration section for the task (I UNchecked System Configuration since that section cannot be imported into an existing project, but the Memory Configuration can):

Code: [Select]
// Options: Export code block eventlogger3 from address 0 to 1;
// Code Block delimiter instructions; Formatted Rung Comments;
// Element Documentation Database w/Flags; Memory Configuration/Devices with User Add-Ons only;
// use Element names (no NickNames); rung/address annotations;
// <SPACE> parameter delimiter;
// Write/overwrite file D:\codeMTX\Design\Sample Projects\MyExport3.txt

PLC BX-DM1E-18ED13

#BEGIN MEM_CONFIG
 eventlogger3 TASK  0 -1
#END

// Beginning of Code Block eventlogger3
$TSK eventlogger3

// Rung eventlogger3#1
// Offset 0
STR ST1
OUT C222

// End of Code Block eventlogger3
$TSKEND eventlogger3

Note the eventlogger3 definition in the MEM_CONFIG section.

I tried it using the default "as instructions" and got your first set of errors since this is an entire TASK code block and cannot be inserted into an existing code block:
Code: [Select]
[Error] No logic inserted at $Main#1
[Error] Instruction "$TSK" cannot be inserted as a user instruction
[Error] Instruction "$TSKEND" cannot be inserted as a user instruction

I then repeated the Insert Instructions, but as a Code Block and the eventlogger3 TASK code block imported (see attached image).

The Import mechanism is powerful, but has lots of possibilities for failure since the .txt file can contain ANYTHING.  Sadly, the Export mechanism is the only good way to understand the requirements of the Import function.

63
When trying to copy paste or import tasks I get the following errors that appear to disallow users to import them.

This seems like a bug, why would this not be allowed when programs are allowed for import and export? Perhaps the import check has a bug. Either way it is impeding progress on an important project and I would very much appreciate any help on this issue.
I tried copy pasting a full task

DMD version: 2.11.2

when copy pasting these are the errors
[Error]      No logic inserted at eventlogger2#1
[Error]      Instruction "$TSK" cannot be inserted as a user instruction
[Error]      Instruction "$TSKEND" cannot be inserted as a user instruction

Then I tried text export and import

the whole file is
Code: [Select]
// Options: Export code block eventlogger2 from address 0 to 1;
// Code Block delimiter instructions; Formatted Rung Comments;
// use Element names (no NickNames); rung/address annotations;
// <SPACE> parameter delimiter;
// Write/overwrite file C:\Projects\why_does_this_not_import.txt

PLC BX-DM1E-18ED23-D

// Beginning of Code Block eventlogger2
$TSK eventlogger2

// Rung eventlogger2#1
// Offset 0
STR ST1
OUT C222

// End of Code Block eventlogger2
$TSKEND eventlogger2

I changed all instances of eventlogger2 to eventlogger2_copy

the new file is
Code: [Select]
// Options: Export code block eventlogger2_copy from address 0 to 1;
// Code Block delimiter instructions; Formatted Rung Comments;
// use Element names (no NickNames); rung/address annotations;
// <SPACE> parameter delimiter;
// Write/overwrite file C:\Projects\why_does_this_not_import.txt

PLC BX-DM1E-18ED23-D

// Beginning of Code Block eventlogger2_copy
$TSK eventlogger2_copy

// Rung eventlogger2_copy#1
// Offset 0
STR ST1
OUT C222

// End of Code Block eventlogger2_copy
$TSKEND eventlogger2_copy


I import it with
As Code BLocks on, Ignore Element Documentation on and Ignore MEM_CONFIG Sections

Tools> Insert instructions from file

Errors:
[Error]   why_does_this_not_import copy.txt(10)   $TSK P1 Task: Invalid element type
[Error]   why_does_this_not_import copy.txt(18)   $TSKEND P1 Task: Invalid element type

when trying to insert as rungs I get the following errors

[Error]   why_does_this_not_import copy.txt(10)   $TSK P1 Task: Invalid element type
[Error]   why_does_this_not_import copy.txt(18)   $TSKEND P1 Task: Invalid element type

I could use some help duplicating the tasks I have written as I have a template I made that I need to use in a number of places throughout the code. Not being able to duplicate it and import the text file doesn't seem to be something that would be intentional.

If anyone has any tips, ideas, or solutions it would be an immense help and I would greatly appreciate it.
64
Oh! I just tried the STRPRINT STR2INT Base 2. That works great!

Thanks!
65
Thanks BobO, I figured it was going to be more involved. It is indeed a decimal number, unfortunately (for me). I am "decoding" quite a lot of strings to extract data and how each is to be interpreted. This is based on which HMI screen is displaying to keep the number of parameters somewhat frequently updated at 9600 baud. Each has to be requested individually, wait for response, decode it, then do stuff.

Did I mention these are mostly not even contiguous? The discrete bits being sent as digits slipped by me. Since only about 9 of these are coded in this fashion it screws up being easy to decode.
66
It sounded like you started with an ASCII string of a binary value, then converted it as decimal through STR2INT? If so just change STR2INT to use base 2 (it defaults to 10) and you have exactly what you're asking for. If you really are starting with a decimal representation of a binary number, then I would reverse the process and use STRPRINT to go to the binary string, then use STR2INT(base 2) to convert it.
67
I have a decimal value that if a digit is 1, I need to set a bit for that digit to use in logic and HMI.
So if D1 is 10,000,001 in decimal, I need to set bits to correspond to the digits that are one, so D2 = 1000 0001 binary.

This is a serial response to queries over StreamIn/Out for custom protocol.
68
You have a binary string and want the decimal representation? STR2INT set to base 2 will give you exactly what you want.
69
Example: 
If D1=111 decimal, I want to get:
D2:0 = 1
D2:1 = 1
D2:3 = 1
D2:4 = 0
D2:5 = 0
D2:6 = 0
D2:7 = 0
(D2 = 7 decimal)

I'm hoping it doesn't require looping. The D1 value is actually from an 8 character ASCII string "00000111" converted with STR2INT.
70
Do-more CPUs and Do-more Designer Software / Re: Incomplete Status Display
« Last post by franji1 on April 07, 2026, 08:36:27 AM »
I still have that weird thing where Ctrl-Down doesn't insert a row and vertical line.   Used to be somewhat intermittent, but now seems more consistent.   Different PC and different keyboard than when I originally posted about it.

Yeah, very strange.  That's all Windows messaging stuff, that normally "just works".  Does any other Ctrl+Arrow not work (i.e. for drawing), or Ctrl+Shift+Arrow (for deleting)?  Ctrl+Down is most common, however.  I sometimes do Ctrl+Up Arrow in the Output column to "insert" a row "above" for the output column (vs. Insert Row).
Pages: 1 ... 5 6 [7] 8 9 10