S7-200 Freeport Mode

Clay B.

Lifetime Supporting Member
Join Date
Jun 2005
Location
Concord,NC
Posts
1,304
Background:

Using a S7-200 to talk to a Mettler Toledo Weight Controller. The comms is RS-232 serial. I have done this with an AB Micro Logic PLC but now I need to do it with an S7-200.

Problem:

I do not understand how freeport mode works. I have an example from Seimens (Tip 005) but I am just not getting it.

What I need to do is send an ASCII 'P' to the weight controller so it will send back the tare, net and gross weights. Once I have this I will repeat the send. I am attaching the tip program in hopes somone can explain it to me. The problem I have is getting data back. I do not think I understand how the interupts are supposed to work. Also the trigger for the XMT somehow ties into the read interrupt but it only works when I stop the PLC set it to 1 and then restart the plc. Like I said I am confused


Any help would be appriciated.

Also right now I have the PLC writing to a Hyperterminal on a PC so I can see exactly what is being sent and what I am sending.
 
Siemens tips always seem to make thing harder to understand rather than easier. If you have done something similar with AB then I would just bring that logic into what you want to do with the Siemens. First off, in the S7-200 manual read the section, Communication Instructions, Transmit and Receive Instructions (Freeport). You don't have to use Interrupts, unless of course the timing of the message is vital. Communication between two devices always follow a similar pattern:

You set up the comms port.

You move a message to a transmit buffer.
You tell the controller that the message is ready for transmit.
The controller tells you that the transmit is complete.
You put the controller in to receive mode.
The controller receives the message, puts it into a receive buffer, and can use various means to know when the message is complete.
The controller tells you when the message is complete.
You may check that the message isn't corrupt.
You 'do something with the data'.
If you need to receive again you cycle back to the 'message to transmit buffer' section or just wait for another message.

I think I have remembered all the steps needed. Oh and remember that using Freeport will disable that Port from normal programming use unless you put the PLC into Stop mode.

Bryan
 
Siemens tips always seem to make thing harder to understand rather than easier. If you have done something similar with AB then I would just bring that logic into what you want to do with the Siemens. First off, in the S7-200 manual read the section, Communication Instructions, Transmit and Receive Instructions (Freeport). You don't have to use Interrupts, unless of course the timing of the message is vital. Communication between two devices always follow a similar pattern:

Maybe it is my age but I find Serial to be a pain with any. I just happen to have worked thru the Pain with AB.

You set up the comms port.

I assume this is where you configure SMB30

In my case I want to move 1001 binary into it with a MOV_B comand

You move a message to a transmit buffer.

This is where I use the XMT? My plan is to use a VB adress where I load my 'P'. Kinda grey here it looks to me from the example that I use the first byte to set up the size of the message in bytes and then depending on my size, in my case 1 byte I would place my value

So if I was using VB1000 as my TBL adress in my XMT then VB1000 would contain a 1 and VB1001 would contain the 'P'

You tell the controller that the message is ready for transmit.

This is done with the XMT comand correct?


The controller tells you that the transmit is complete.

What do I lok at to see this?

You put the controller in to receive mode.

This is where I use RCV? The table here here is used to recieve my message? IE If my return message is 26 characters then I would set up VB2000 with a value of 26 and VB2001 thru VB2026 would contain these characters.


The controller receives the message, puts it into a receive buffer, and can use various means to know when the message is complete.

Is the buffer the table I used in the RCV?


The controller tells you when the message is complete.
You may check that the message isn't corrupt.

Am I checking size here? IE would I be looking for 26 characters?


You 'do something with the data'.

Now this part I can do.

If you need to receive again you cycle back to the 'message to transmit buffer' section or just wait for another message.

Is this where in the example they are using the Recieve Complete Interupt? I could just use a timer couldn't I? Say run the send recieve every 250mSec.

I think I have remembered all the steps needed. Oh and remember that using Freeport will disable that Port from normal programming use unless you put the PLC into Stop mode.

Already, saw this coming, the PLC I speced for the job has 2 com ports so my second is still open when I am not plugged into my touch screen.
 
Last edited:
I got a sample of 2 S7 200 plc's talking to each other if this helps. I wanted to ask did you convert the RS485 on the port to RS232 or do you have a PPI to RS232 or ??? Intriqued I have a problem the other way to talk RS232 to the PLC.
 
What I am trying to talk is RS232. Acording to the manual this is done by your configuration of the SMB30 byte. Still working on my project so if anyone else has any idas I would be real glad to here them.
 
What I am trying to talk is RS232. Acording to the manual this is done by your configuration of the SMB30 byte. Still working on my project so if anyone else has any idas I would be real glad to here them.
I have worked on a project with S7-200 using the "Freeport" mode to transfer data to a database on a PC.
Freeport----> PPI adpt----> PC Serial port.
We did use the PPI cable/adapter though.
Not sure if it is true RS232 out of the PLC port.
I'll try and find the project when I get a chance to dig through some files on an old laptop.
Just so you are aware of it: Once the port is setup for "Freeport" Mode, you won't be able to connect to the PLC through the same port. Unless you have a 2 port system. Or place the CPU to "Stop" which will disable the "Freeport" mode.
 
Sorry I don't have time to go through all the questions you put against my first reply. I have bodged together a quick program that transmits data out of Port 1 on the PLC. Each time you move the TERM switch between TERM and RUN the program transmits a short well known message. Port 1 is RS485 and I have set it up for 19200 baud so that I can just swap the programming cable from programming duty to data duty. Don't forget that MicroWin will hog whichever port you give it so you will either have to shut the prgramme down or use two serial ports on your PC. If I get time over the weekend I will try to go through your list of questions.

Bryan
 
freeport and moxa

I am using a 224XP in freeport mode. (both 0 and 1 ports) It perfectly works, but only with the computer. Sends and recieves the data I want, then I connect it to the SIM508 GPRS/GSM/GPS modul, and nothing seems to happen. The adapter is: MOXA TCC-80 in two wire RS-485 mode.
Please someone help me. What can be the problem?
 
Dear Sir,
Kindly give a advice according to my Green Color Sentence
Tip 28b(Subroutine_0)

LD Always_On:SM0.0 // Load SM0.0.
MOVB 16#45, P0_Config:SMB30 // Enable Freeport mode; 19,200 baud;
// 8 bits per character; even parity.
If Baud rate 38,400 or 9600 What will be Hexadecimal Valu(16#?)?
MOVB 16#0E, VB99 // Indicate a Transmit buffer size of 14 bytes.
What is Transmit buffer size? What is the Function of Transmit buffer size? When I use Indicate a Transmit buffer size of 12 bytes. Then I may write 16#0C instead of 16#0E The VariableV99 I can use difference Variable instead of V99 for Transmit buffer size?
MOVB 16#02, VB100 // Indicate the start of text (STX) to be transmitted.
What is start of text (STX)? What is the start of text (STX)? The VariableV100
I can use difference Variable instead of V100 for start of text (STX)? When I may write 16#05 instead of 16#02 & I can use difference Variable instead of V100 for start of text (STX)?
MOVB 16#0C, VB101 // Indicate the length (LEN) of the message (12 bytes).
What is the length (LEN) of the message (12 bytes)? When I may write 16#0E instead of 16#0C?
I can use difference Variable instead of V101 for start of text (STX)? the length (LEN) of the message (12 bytes)?
MOVB 16#1, VB102 // Indicate the address (ADR) of the MICROMASTER. (16#1 )
// for MICROMASTER 16#32 for broadcast mode.)
I can use difference Variable instead of V102 for Indicate the address (ADR) of the MICROMASTER? What is the 16#32 for broadcast mode?
FILL +0, VW103, 5 // Clear all five data words (can change later). Why clear VW103, VW105,VW107, VW109, & VW111?
MOVW 16#1500, VW200 // Indicate a frequency multiplier of 1/3 the maximum.
Let me realize what is Frequency Multiplier? What is the Function of Frequency Multiplier?
MOVW 16#32, VW202 // Indicate a frequency multiplier increment/decrement of 50.
What is the Frequency Multiplier increment /Decrement? What is the Function of increment /Decrement?
MOVD 16#00030003, VD204 // Set Transmit and Receive retry counts to 3.
What is Transmit and Receive retry counts to 3?
MOVB 0, VB210 // Clear the operation status indicators.
MOVB 0, QB0 // Display an operation status of no errors.\
What is the Display an operation status of no errors.?
MOVB 0, VB219 // Indicate the address of the S7-200 PLC as 0.
This is Master address 0
S M0.0, 1 // Allow RUN or RAMP (and a change of direction).
ENI // Enable all interrupt events.
 
Thank you for your advice. But Still Problem to understand my Program as follows

Network 1 ([FONT=&quot]Transmit Network For Free Port)[/FONT]
LD SM0.0
MOVB 16, VB99
MOVB 16#02, VB100
MOVB 16#0E, VB101
MOVB 16#1, VB102
Above Move Function I have understood
Below Move Function I have not understood yet. What is the function of VW103, VW111, VW113, VB115 & VD988
MOVW 16#1206, VW103
MOVW 16#043C, VW111
MOVW 16#2000, VW113
MOVB 0, VB115
MOVR 16384.0, VD988
Network 2 ([FONT=&quot]Receive Network For Free Port)[/FONT]
LD SM0.0
MOVB 16, VB199
MOVB 16#02, VB200
MOVB 16#0E, VB201
MOVB 16#1, VB202
Above Move Function I have understood
Below Move Function I have not understood yet. What is the function of VW203, VW211, VW213, VB215
MOVW 16#1211, VW203
MOVW 16#047C, VW211
MOVW 16#0, VW213
MOVB 0, VB215
Network 3
LD SM0.0
ENI
Network 4
LD SM0.0
MOVB 16#49, SMB30
MOVB 16#80, SMB87
Network 5
LD SM0.0
Below Move Function I have not understood yet. What is the function of VB500, VD1000, VD1010, VB600, VD2000 & VW2010
MOVD &VB500, VD1000
MOVW +0, VW1010
MOVD &VB600, VD2000
MOVW +0, VW2010
 

Similar Topics

Dir sir! I am using citect scada v5.50 and S7-200,cpu 215.Via PC/ppi cable ,i want to use citect to control that PLC,do i use freeport mode in...
Replies
14
Views
3,882
Hello guys, I know another freeport question.. I am trying to set up communication between via a rs 232 digitizer to PLC. I am using hyper...
Replies
5
Views
2,037
Hi There I need to write the current DateTime to a printer on Port0. Any quick way of doing this without having to convert BCD-to-Int and then...
Replies
2
Views
1,717
T
is it possible to establish a freeport communication over a usb ppi cable?
Replies
2
Views
10,905
R
When you are using freeport communication mode on Siemens S7-200 , once you got enabled the freeport mode changing the configuration, How can we...
Replies
5
Views
3,596
Raquel
R
Back
Top Bottom