Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ERokc on August 04, 2013, 07:21:13 PM

Title: Creating ROM tables in Do-more
Post by: ERokc on August 04, 2013, 07:21:13 PM
I need a table in memory and have created a Memory Block for it. The only way I see to get data into it is with INIT.  Please tell me there is a better way.  I have 250 entries to make.  Not impossible with INIT BUT!
Title: Re: Creating ROM tables in Do-more
Post by: BobO on August 04, 2013, 08:32:40 PM
There is no concept of ROM in Do-more at this point. We are planning to add a small ROM based file system in the future, which would be pretty well suited to what you are doing, but for now INIT is it. You might try the export/import facility as a faster way to enter the INIT...
Title: Re: Creating ROM tables in Do-more
Post by: ERokc on August 04, 2013, 09:04:25 PM
I get the options of Project and Element Documentation when I choose Import.  I'm afraid to use a function I'm not familiar with as I have experienced corruption when doing so.
Tell me about export/import, please.
Title: Re: Creating ROM tables in Do-more
Post by: franji1 on August 04, 2013, 09:37:31 PM
Using Tools->Insert Instructions from File can let you insert instructions as mnemonic text from a file.

Below is an INIT instruction, of which I've also attached the screen shot.  Some are ranged.  Some are single initializations.  Some are real, negative, positive values.

Note that the leading 3 in the INIT "3 ..." must NOT change.  It tells the import how many parameters there are PER ROW (since ALL the rows are on a single line, in double quotes).  If you have any questions about the pattern, just ask here.

Code: [Select]
// this first line is important - it tells the import which PLC this is targeting (change the part number to H2-DM1 or DM-SIM if necessary)
PLC H2-DM1E

STR ST1
INIT "3 V100 V109 42 D20 D33 -5 V110 ST1023 1 R22 ST1023 3.14 R100 R199 1.234"
// ST1023 for the END of RANGE is how Designer internally designate NO RANGE

Just insert those/your lines in your own .TXT file and use the Tools menu mentioned at the top.  Make sure you are in EDIT MODE (Ctrl+E)  And see the attached screen shot.
Title: Re: Creating ROM tables in Do-more
Post by: Controls Guy on August 04, 2013, 10:30:44 PM
I need a table in memory and have created a Memory Block for it. The only way I see to get data into it is with INIT.  Please tell me there is a better way.  I have 250 entries to make.  Not impossible with INIT BUT!

Are these programmed constants that never need to change at runtime?

Would the symbolic constant feature give you work for you, or do you need the table feature so you can address it with pointers?
Title: Re: Creating ROM tables in Do-more
Post by: ERokc on August 05, 2013, 03:28:11 PM
Controls Guy, I need a table with pointers.  It this point it will have about 250 bytes.
I don't want to spend any more time typing than I have to.  Let the computer do it.  That's why I own one. I will have to enter the original bit pattern into Excel but from there the computer will save a bunch of typing especially using the "Insert Instructions".

franji1, I got it to go after a syntax error.  Learned long ago syntax means I typed it wrong.

I don't have any ranges in my data table.  Is there a way to enter without ST1023 in every second field?  If not I know how to stick it in the file.



Thanks guys!
Title: Re: Creating ROM tables in Do-more
Post by: franji1 on August 05, 2013, 03:35:57 PM
I don't have any ranges in my data table.  Is there a way to enter without ST1023 in every second field?  If not I know how to stick it in the file.
In Excel, it's easy to duplicate a value down a column.  There are multiple ways to do it.  Make the cell text (which "ST1023" should be), then drag the corner of the source cell down 250 rows.

In your text editor, do paste, next word, next word, paste, ..., or record it as a macro (if your text editor supports it - notepad++ is a good one), then just run the macro 250 times.
Title: Re: Creating ROM tables in Do-more
Post by: Controls Guy on August 05, 2013, 05:55:37 PM
The tabular data views ("memory dumps") might help with the solution of this too, since you can create a backup of PLC memory.  INIT is more foolproof though, because if something gets overwritten, it will get fixed on every powerup.
Title: Re: Creating ROM tables in Do-more
Post by: BobO on August 05, 2013, 05:58:03 PM
Ultimately, the file system will provide an ideal way for doing something like this. Bulk persistent storage that doesn't burn program space. Loadable via a single call. Until then... :-[