Siemens Encode & Decode function

TEOWK

Member
Join Date
Oct 2004
Location
Batu Pahat
Posts
38
I am studying Siemens s7-300 PLC. There are 2 built-in function that seems confusing to me. ie. Encode & Decode FC83
Please suggest an application example using this function.
 
it's under Standard Library....TI-S7 Converting Blocks
oh... and i made a mistake
it should be FC96 and FC97
sorry for the mistake
 
Last edited:
OK. Now I see. So it looks to me like enocode makes convertion from 1 of 31 code into binary and decode makes opposit convertion.
Possible app is keyboard (it can give you number of pressed button) for encode FC or (not sure about my translation into English) "light dial/scale" for decode FC.
 
To find out what a certain function does, it is enough to select that function in the instruction browser and press the F1-key.

The funcions you're talking about are:
  1. FC96 - ENCO
    This function returns in RET_VAL the bitnumber of the first set bit in the value in parameter IN starting from the right.
    IN = 0001_0101_0000_1000_0101_1111_0100_0000 -> RET_VAL = 6
  2. FC97 - DECO
    This functions sets one bit (bitnumber 0-31 in parameter IN) in a double word (parameter RET_VAL). If the value in IN is greater than 31, modulo 32 is calculated first, eg. 35 sets bit 3.
    IN = 5 -> RET_VAL = 0000_0000_0000_0000_0000_0000_0010_0000
    [/list=1]
    Kind regards,
 

Similar Topics

HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
7
Views
159
Hi PLC people, think about this scenario: The PLC is somehow connected to the same network with the facilities` network. Then someone connects to...
Replies
2
Views
84
Hello everyone, I've had this issue for the last 2 days where I try to assign the profisafe address to an IO block (6ES7 146-6FF00-0AB0) but when...
Replies
5
Views
152
Hello, good morning, I have been having two problems with the Tia Portal software. The first is that I have installed it on my computer and...
Replies
5
Views
184
Hello to all, I'm just starting with using CodeSys. Immediately, I have noticed that Codesys doesn't use data blocks like for example S7 does...
Replies
11
Views
182
Back
Top Bottom