I don't know if you have the manual for the S7-200, but in appendix D (regarding Special Memory Bits) it is described how to use the position of the mode switch todo this. I have once used this and in my program there was a subroutine to do this. This is the listing of this routine:
NETWORK 39
SBR 0
NETWORK 40
//Stop/Run/Term switch in term position:
//-reset comms, put port in PPI mode, detach and disable
//interrupts
//
LDN SM0.7
O SM0.1
MOVB 16#C8, SMB30
DTCH 8
MOVB 0, VB516
DISI
NETWORK 41
//Switch in Run position:
//-initialize freeport mode, enable interrupts. Needs to be
//one-shotted so that ISR0 can detatch itself when complete,
//and attach ISR1
//
LD SM0.7
EU
LD SM0.7
A SM0.1
OLD
MOVB 16#49, SMB30
ATCH 0, 8
ENI
NETWORK 42
//51h=2400 baud
//4Dh=4800 baud
//49h=9600 baud
//45h=19200 baud
RET
Kind regards,