MVI69-GSC: possible problems in the provided PLC program
You need to be logged in to get access to the forums. You can do so here
|
pseudoquas
|
Tuesday 06 September 2005 3:46:02 am |
|
|
MVI69-GSC: possible problems in the provided PLC program
I've identified some problems with the sample program provided for this module. If I am mistaken in any way, by all means respond. Thanks!
1. MainRoutine Task:
Rung 0:
The JSR to ProcessBlock is preceded by a condition that "NEQ Local:1:I.Data[0] -1". However, the range of possible values for this input register apparently(?) are limited from 0 to 127. This precondition should be removed since it will never be false.
2. ProcessBlock:
Rung 2:
This contains a "COP SOURCE: GSC.P1_Data.WriteString DEST: Local:1: O.Data[3] LENGTH: GSC:P1_Data.WriteLength"
However, the WriteLength variable is the number of 8 bit characters to transmit BUT the DEST registers are 16 bit INT. Since the COP Length refers to the number of DEST tags, you will transmit 2X WriteLength characters from the WriteString(8bit) to the O: Data (16 bit). ALSO, WriteLength must not be greater than 25, or you will begin to write over port2 data, starting at O: Data[28]!!!
Next Issue:
WriteLength cannot be greater than 50, because that exceeds the available O:3-O:27 Data space(16 bit INT)! Therefore, tags GSC.P1_Data.WriteString[50-199] can never be transmitted in the program as written and thus should be deleted.
Rung3: "FLL 0 Local:1: O.Data[2] Length 25" should actually be length 26 to fill Data[2-27]. Beyond that, the FLL isn't necessary, since data-write is triggered by a non-zero WriteLength value. If asyncronous capture of old data is of concern, simply flip the COP instructions in Rung 2 so that good data is in place prior to filling in WriteLength value.
Again, if I am off-base in any way, please respond!
Thanks
|
|
jsanders
|
Thursday 17 November 2005 10:03:12 am |
|
|
RE:MVI69-GSC: possible problems in the provided PLC program
1. On this point you are essentially correct. The second NEQ condition is extraneous, will never be false, and may be safely removed...although it also does no harm to leave it there. It is simply extraneous.
2. The comment about Rung 2 is also correct. The LENGTH should be GSC:PxData.WriteLength divided by 2. This will also be true for the Port 2 Write in Rung 4.
Next Issue:
This statement is correct. Again, the extra memory space in the array is merely extraneous. The array size can be reduced or left as-is. The program will work either way.
Rung 3:
This comment about changing the LENGTH of the FLL to 26 is valid...although the last part of that comment is not. The module needs to have the FLL in place to operate correctly.
|