You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old January 16th, 2004, 04:12 PM   #1
fatema
Member
Canada

fatema is offline
 
Join Date: Oct 2003
Posts: 5
read/write error of main sequence program of mitsubishi a series plc

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;
}
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
PLC Program Management zmanvortex LIVE PLC Questions And Answers 5 November 1st, 2004 10:03 AM
Mitsubishi FX series PLC? Ken LIVE PLC Questions And Answers 11 December 11th, 2002 01:54 PM
Mitsubishi PLC FX 1N series Deepak Bodhani LIVE PLC Questions And Answers 0 June 29th, 2002 06:55 AM
Mitsubishi PLC FX-1N series Deepak Bodhani LIVE PLC Questions And Answers 0 June 29th, 2002 06:24 AM


All times are GMT -5. The time now is 06:59 AM.


.