E556GB — 5.2.6 Example program “serial communication“

KUBES modules 34: ; Send single characters 35: ; ====================== 36: ; Specify transfer interval (every second) 37: S_SINGLE L T00.02 ; current value 38: CMP SBM00.00 ; old value 39: JP= REC ; second not passed yet 40: = SBM00.00 ; store new value 41: ; Send 42: SEND JPK V24667IS ; KUBES module 43: L SND_RUN FBM01.04 ; (255 =start transfer, 0=ackn.) 44: JPC END_SNGL ; still sending 45: L PC00.02 ; clock gen. value as s_char. 46: = SND_CHR FBM01.03 ; (character to be sent) 47: C8T1 O00.08 ; show SND_CHR at outputs 48: L 255 49: = SND_RUN FBM01.04 ; (255 =start transfer, 0=ackn.) 50: END_SNGL JP REC 51: 52: ; Send strings 53: ; ============ 54: ; Specify data to be sent (here:

" PLC ") 55: S_STRING JPK SST667IN ; KUBES module 56: L $02 ; STX (Start of Text) 57: = SDATA FBM01.09 ; (start of s_data field) 58: L 'S' 59: = FBM01_10 FBM01.10 ; (data to be sent) 60: L 'P' 61: = FBM01_11 FBM01.11 ; (data to be sent) 62: L 'S' 63: = FBM01_12 FBM01.12 ; (data to be sent) 64: L $03 ; ETX (End of Text) 65: = FBM01_13 FBM01.13 ; (data to be sent) 66: LENGTH L 5 ; length of data to be sent 67: = SDAT_LEN FBM01.08 ; (qty. of s_data bytes) 68: ; Send 69: SEND_STR L SND_RUN FBM01.04 ; (255 =start transfer, 0=ackn.) 70: JPC END_STRG ; still sending 71: L 255 72: = SND_RUN FBM01.04 ; (255 =start transfer, 0=ackn.) 73: END_STRG NOP 74: 81