Programming - First steps
P.
70 of 349
[EibPC]
// Variables
Command=0u32;Number1=0u32;Number2=0u32; FloatingPoint=0f32
IP=0u32;Port=0u16
// The both telegram types
CheckSender=(IP==192.168.22.22) and (Port==5220u16)
Telegram=(event(readudp(Port,IP,Command, Number1, FloatingPoint, Number2 )) or
event(readudp(Port,IP,Command, FloatingPoint, Number1))) and CheckSender
// Sum back
if Command==1000u32 and Telegram then
\\
sendudp(Port,IP, 1100u16,Number2, FloatingPoint, Number2 ) \\
endif
// Difference back
if Command==1001u32 and Telegram then
\\
sendudp(Port,IP, 1100u16,Number1, convert(Number1, FloatingPoint)-
\\
convert(Number2, FloatingPoint), Number2 ) \\
endif
// Square root
if Command==2001u32 and Telegram and FloatingPoint>0f32 then \\
sendudp(Port,IP, 2001u16,sqrt( FloatingPoint), 0u32 ) \\
endif
// Square root
if Command==2001u32 and Telegram and FloatingPoint<0f32 then \\
sendudp(Port,IP, 2001u16, FloatingPoint, 1u32 ) \\
endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]