Hi,
I am writing java code to read the Main sequence program from mitsubishi A series CPU namely A1SCPU. The default capacity
of this program is 6k steps (6 * 1024 = 6144 steps).
Now each step has 2 bytes hence 12k (1024 * 12= 12288)bytes in total to be read
Now since one can read maximum of 256 steps in one exchange I have to loop to read all the 6 k steps.
The problem is when i am trying to read the last step. i.e 6143 rd step it gives an end code of 5B (hex) with 13(hex)
as error code which says that a step no. that exceedsthe program capacity range set by the pc cpu parameter.
Is is a valid failure?. If I read one step less there is no problem.
Similar problem happen if I write onto the plc.
Does any body know why I get the error ?
here is the code of reading the sequnce program
private byte[] readMain()
{
byte[] readMain = new byte[] {
0x0A, // command code
(byte) 0xFF, // local station
0x00, // lower order byte of ACPU monitor timer
0x00, // higher order byte of ACPU monitor timer
0x00, // lower order byte of head step no.
0x00, // higer order byte of head step no.
0x00, // number of steps (specify 00h for 256 steps)
0x00};
byte[] buffer = new byte[12288]; // 12k
int head = 0;
for (int i = 0; i < 24; i++)
{
readMain[4] = (byte) (head & 0xff);
readMain[5] = (byte) ((head >> 8) & 0xff);
send(readMain); // sends the packet
byte[] temp = ..... // received packet of bytes
// check the end code
if (temp[1]== 0x00) // no error
{
System.arraycopy(temp,2,buffer, head * 2,512);
head += 256;
}
else
{
// some problem /error
System.out.println("End code is "+temp[1]);
}
}
return buffer;
}
I am writing java code to read the Main sequence program from mitsubishi A series CPU namely A1SCPU. The default capacity
of this program is 6k steps (6 * 1024 = 6144 steps).
Now each step has 2 bytes hence 12k (1024 * 12= 12288)bytes in total to be read
Now since one can read maximum of 256 steps in one exchange I have to loop to read all the 6 k steps.
The problem is when i am trying to read the last step. i.e 6143 rd step it gives an end code of 5B (hex) with 13(hex)
as error code which says that a step no. that exceedsthe program capacity range set by the pc cpu parameter.
Is is a valid failure?. If I read one step less there is no problem.
Similar problem happen if I write onto the plc.
Does any body know why I get the error ?
here is the code of reading the sequnce program
private byte[] readMain()
{
byte[] readMain = new byte[] {
0x0A, // command code
(byte) 0xFF, // local station
0x00, // lower order byte of ACPU monitor timer
0x00, // higher order byte of ACPU monitor timer
0x00, // lower order byte of head step no.
0x00, // higer order byte of head step no.
0x00, // number of steps (specify 00h for 256 steps)
0x00};
byte[] buffer = new byte[12288]; // 12k
int head = 0;
for (int i = 0; i < 24; i++)
{
readMain[4] = (byte) (head & 0xff);
readMain[5] = (byte) ((head >> 8) & 0xff);
send(readMain); // sends the packet
byte[] temp = ..... // received packet of bytes
// check the end code
if (temp[1]== 0x00) // no error
{
System.arraycopy(temp,2,buffer, head * 2,512);
head += 256;
}
else
{
// some problem /error
System.out.println("End code is "+temp[1]);
}
}
return buffer;
}