' 2x WLAN RS232 Device Server ' (c) Avisaro AG 28.08.2012 ' Version 3-2 inmode -3 outmode -2 ' 2. Serielle Schnittstelle auxopen -4, 9600, asc("N"), 1, 8, asc("N") exec "stpseq +\097+v+i+s+" sleep 100 exec "prompt" sleep 100 exec "sched 0" sleep 100 let n = 0 REM Default-Werte ? if ((KEYS & 1) = 1) then for n = 0 to 100 if ((KEYS & 1) = 0) then goto STARTING end if setleds 255 sleep 10 setleds 0+128 sleep 10 next n exec "restart clear" sleep 100 setleds 255 do sleep 1 loop end if STARTING: sleep 400 DIM A(1700) let y = 0 MAIN: if ((KEYS & 1) = 1) then close 101 close 102 end if ' ' 1. Serielle Verbindung ' let y = status(101) if (y = 0) then ' Socket zu ' Listen listen 101, 23, 0 ' Connect 'let y = RESOLV("192.168.0.67") 'connect 101, y, 23, 0 end if if (y = 9) then ' Socket verbunden get 101, A if BYTESREAD > 0 then repeat_putRS232_1: put -2, A, BYTESREAD if LASTERR <> 0 then sleep 0 goto repeat_putRS232_1 end if end if get -3, A if BYTESREAD > 0 then repeat_putlan1: put 101, A, BYTESREAD if LASTERR <> 0 then let y = status(101) if (y = 9) then sleep 0 goto repeat_putlan1 end if end if end if end if ' ' 2. Serielle Verbindung ' let y = status(102) if (y = 0) then ' Socket zu ' Listen listen 102, 24, 0 ' Connect 'let y = RESOLV("192.168.0.67") 'connect 102, y, 24, 0 end if if (y = 9) then ' Socket verbunden get 102, A if BYTESREAD > 0 then repeat_putRS232_2: put -4, A, BYTESREAD if LASTERR <> 0 then sleep 0 goto repeat_putRS232_2 end if end if get -4, A if BYTESREAD > 0 then repeat_putlan2: put 102, A, BYTESREAD if LASTERR <> 0 then let y = status(102) if (y = 9) then sleep 0 goto repeat_putlan2 end if end if end if end if goto MAIN: '+++ 'a+v+i+s