help needed with mitsubishi FX2N CRC

sorrrrrin

Member
Join Date
Oct 2005
Location
craiova
Posts
15
hello, I'm developing a program in java, that should write programs to fx2n plc from mistubishi, via serial port.
I got the comunication protocol , listening with a java program the comunication between the GX Developer and the plc.
The only thing I need is the CRC, that I don't know how to CALCULATE.
Could some please help me with this? Or tell me another method that he tried to comunicate with the plc with a user program (VB,JAVA,VISUAL C.. anything) Thanks verymuch.
 
The easiest way is to install a second port (RS232BD) sits on the main unit, then use the non protocol, it will chuck out a series of Data memories & then read in any serial data, although you will have to process it it's easy, used this to send & receive data to & from a servo drive, there is a manual showing the protocol but I'm not sure if it contains the programmer protocol.
look on meuk site (mitsubishi).
 
And how I install a new com?
So if I set it to no protocol, the crc is not used?
in GX developer I guess this is done in PLC parameters, correct me if i'm wrong, thanks for your answer.
 
Last edited:
another question:
I saw in the FX communication user manual a protocol named computer link, where it can be written a bit/word device, or something else.
I tried to send on serial port such command, but it dindn't work.If you know could you please help me with this too?

the comand for writing a bit device was something like this:
ENQ - number station - number plc - comanda(BW) -message wait time - head device(M for example) - unmber of devices - data - (sum checkcode)
 
The Computer link mode is for using the mitsubishi protocol, I have done a short program for no protocol method, I will dig it out if I can & post it. It was only used for a trial so not sure if I still have it, probably take me a few days as it is at work.
 
I have siemen's PLC software Linenced Step-7v: 5.3, and Licensed Simatic Step-7 version: 5.2, Microwin, Step-5 (Licensed). Protool/Pro Runtime (licensed), Protool/Lite, Profinet, Simovis and global drive control at very nominal prices. Interesed may contact at [email protected] or call at my cell 0092 300 663 8987
 
parky said:
The Computer link mode is for using the mitsubishi protocol, I have done a short program for no protocol method, I will dig it out if I can & post it. It was only used for a trial so not sure if I still have it, probably take me a few days as it is at work.

I wonder why it didn't work to transmitt something with this computer link protocol.. I tried at first to transmitt a write bit device command with computer link protocol (exactly like in the manual : ack ......... crc), but it did nothing;
Could you tell me the way that "no protocol" works? , maybe you can give me an example or something that you saw working..or the little program that you made with no protocol would be excelent.. thanks very much.
 
Last edited:
Hi,
I have listed below some of the things you need
unfortunately I have deleted my test program & do not have GXDeveloper re-installed as of yet however below is a program shown in statement list.

Flags for Data Transmission
M8121 Data Transmission Delayed
M8122 Data Transmission Flag (send Data)
M8123 Data Received (finished receiving data)
M8124 Carrier Detection
M8125
M8126 Global Flag (Dedicated Protocol)
M8127 On Demand Handshake Flag (dedicated protocol)
M8128 On Demand Error Flag (dedicated protocol)
M8129 On Demand byte/word flag (Dedicated protocol)
M8161 Selection of 8 bit instructions (asc,rs,asci, hex, ccd)
Data Registers
D8120 Communications format
D8121 Local station number
D8122 Amount of data to transmit
D8123 Amount of data already received
D8124 Data Header (default STX (02H)
D8125 Data Terminator (Default ETX (03H)
D8126
D8127 On Demand Head device register
D8128 On Demand Data Length register
D8129 Data Network timeout value

D8120 Comms format
bit 0 = 7 bit off 8 bit on (databits)
bit 1,2 = parity 00 = none, 01 = odd, 11= even
bit 3 = stop bit 0 =1 1, = 2
bit 4,5,6,7 = speed (baud rate)
0011 = 300, 0100 = 600, 0101 = 1200, 0110 = 2400, 0111 = 4800, 1000 = 9600, 1001 = 19200
Bit 8 header char 0= none 1= whats in D8124
Bit 9 Terminator char 0=none 1= whats in D8125
Bit 10 Reserved
Bit 11 DTR Check 0=send/receive 1=receive only
Bit 12 control line 0= none 1= hardware
Bit 13 Checksum 0 = not added 1= added
Bit 14 protocol 0 = no protocol 1 = dedicated protocol
Bit 15 protocal format 0 = protocol 1, 1 = protocol 4

****Program****
LD m8000 (always on bit)
OUT m8161 (set 8 bit instruction) --| |-------------()

***Set up the Comms Parameters (set bits in D8120)****
LD M8002
MOV H0067, D8120 (set up comms parameters)
LD X0 (just for testing trigger X0)
RS D200,K11,D500,K10 ***do RS instruction [rs D200 K11 D500 K0] (data in D200 to d210 (11) is sent, any data RX'D in D500-510***

*****move data into D200-D210 & set send bit****
LD X1 ***send command bit***
PLS M0 ***create a pulse***
MOV H23 D200 (remember 16 bit words are sent as 2 bytes)
MOV H24 D201
etc........ (move values into d200-210)
SET M8122 ***send data***
***If data received bit on then store data*****
LD M8123 ***data rx'd***
BMOV D500 D512 K10 **move data from receive buffer to store.
RST M8123 reset rx'd flag.
end.
 
excuse me for asking so many questions, but I'm new too this kind off stuff, I do programm plcs and stuff, but I didn't done yet something like this before.
So this program you post and the program from computer which sends data to the plc work togheter like client/server do?

So the

***If data received bit on then store data*****
LD M8123 ***data rx'd***
BMOV D500 D512 K10 **move data from receive buffer to store.
RST M8123 reset rx'd flag.
end.

works something like, if I transmitt something on the serial port with the computer link protocol (ack - station number - ....... crc), the program you gave me should write the data in the plc registers?
or how it works?
I need to transmitt a program via serial port to the plc as I do with the GXDeveloper, and I wonder how to do this with "no protocol".. or any protocol at all.. (I know programming the serial port, setting parameters.. transmitt data..) but I don't know what that plc wants.
Does your program works like I said earlier? if not could you explain please?

And another questin, does this program affects the programming with GXdeveloper ? I mean after I use your RSinstruction program , I can program further with gxDeveloper!
 
Last edited:
The way it works is it is like any comms program, the internal operating system of the PLC knows that because of the RS instruction, it will keep monitoring the port in the background & receive any bytes sent to it.

To send data you will have to put your data into the registers 200-210 (note the amount of registers is a parameter set in the RS instruction), then trigger the send bit, it will not respond to any data received, you will have to look at the data to determine what to send back.

You can program as much as you like with GX Developer, the code for comms is just in the main cycle of program like any other plc code.
all plc's work like this....
at power on things are set dependant on parameters.
Then the cylic starts
1. updates the input image (reads all inputs)
2. processes ladder instructions until the end instruction
3. updates outputs
4. goes back to 1.
then keeps looping round
the only way the cycle is interupted, is by jumping to subroutines (but then it jumps back where it left off
or interrupts (imediate i/o, timers etc.)
basicaly the program is cyclic.
It does not matter where you put the code for comms, at the start, in the middle or at the end it will process it many times a second (this depends on the number & type of instructions used in the program but some idea is a thousand bit instructions (50 lines) like LD X0 OUT Y0 ladder.. -|X0|---(Y0)
(2 instructions)will only take about 50ms to scan).
I'm not sure what data you need to transfer & when but if it is simple stuff like reading various values from the plc for display then manipulate them into the send data registers e.g. all bit values into the first 5 or so data words (5x16 bits)
all other word values into the rest, then just keep sending them as fast as you can, allowing for comms to complete the transmission.
as for received data you could do the following, split the bytes into digital bits & word values you wish to send to plc (although this would be fixed amount i.e. 80 bits & 20 words (40 bytes) or do a bit of work both ends.
e.g. you could have the first bytes as a header, this could contain data like.. 01,10,0 (means the rest of the data contains bits & there are ten bytes of it
02,10,0 means the rest of the data contains words & ten of them.
03,100,5 means send me Data memories, 100 to 104
you could build a very complex header arrangement where the header tells you what data the pc wants or if it is data it is sending.
bear in mnd that the FX has a small memory so if the pc is just to display a few bits/words and send down bits for commands & setpoints then keep it fixed, like every second or 2 send a fixed block of data to the pc & the pc send a fixed block of data e,g. the plc sends 50 bytes (some as bits & some as words or bytes)
the pc does the same
to interpret the bits in the plc
Mov D200 M100 K4 (this moves D200 to D201 into M bits M100 to M31 (32 bits)
Good luck.
 
hi, thanks, but can you tell me what I should transmitt to com so that the plc would do let's say
ld x0 out y0 , and I guess the Rs instruction program has to be modified ..? I need something general, not to be changed anytime I want to transmitt something.
The ideea of what I want to do is that the data transmitted via com,has to make the plc act like I'm writing a program (like I do with GXDeveloper)for example
ld x0

And another question, when I tried the "computer link" protocol
(ack - station number - plc number - ... - crc)
I think I didn't put the plc in the RUN mode, could that may be the cause for not working?
out y0
 
Last edited:
READ THIS not the above message

hi, thanks, but can you tell me what I should transmitt to com so that the plc would do let's say
ld x0 out y0 , and I guess the Rs instruction program has to be modified ..? I need something general, not to be changed anytime I want to transmitt something.
The ideea of what I want to do is that the data transmitted via com,has to make the plc act like I'm writing a program (like I do with GXDeveloper)for example
ld x0
out y0


And another question, when I tried the "computer link" protocol
(ack - station number - plc number - ... - crc)
I think I didn't put the plc in the RUN mode, could that be the cause for not working?
 
I don't know what it will be transmitted from the computer.. some user will make some program that I' ll have to process it, so I think the RS instruction method wouldn't help me?
 
If you didn't understand, I'm trying to develop a program in java like gx developer, which I'll use to program the plc with list instruction mode.
I only need a protocol to transmitt the data to the plc, and store the program in it.

I see that with the RS instruction protocol, I have to know the format of what I'm transmitting.. and the rs instruction program is something linked to the data I transmitt.. but if I want to transmitt any program, I don't know if RS instruction would help me :(
 

Similar Topics

Hi guys, I´m converting a Melsec Medoc Plus 1.40a program to GX IEC Develop 7.04 and have one problem: There is a CMP block im program and when...
Replies
0
Views
1,885
Hey guys, I am starting to sort of understand what is going on in the mitsubishi world of programming, but i am still at a loss when it comes to...
Replies
3
Views
1,699
Stuck interfacing to a Mitsubishi FX1N plc and F930GOT-BWD-E 4" HMI Not up to times with Mitsubishi sinse old "punkin" terminal. Have learned I...
Replies
0
Views
7,414
How Would I Format The Memory Of A Mitsubishi A2n Cpu Plc Without Using Gx Developer Or Any Kind Of Software. The Trial Version Of Gx Developer...
Replies
4
Views
5,457
I have an old PLC (circa 2007) consisting of Telemecanique/Modicon/Schneider Electric devices. The system has developed errors and unfortunately...
Replies
2
Views
223
Back
Top Bottom