2/20/2021 3:46 PM | |
Joined: 9/27/2006 Last visit: 4/27/2025 Posts: 12347 Rating:
|
Translation from the Turkish text (tanls to Google Translate):
Merhaba esmotomasyon; Siemens forumu, dünyanın her yerinden katılımcıları bir araya getiriyor ve hepsi aynı dili konuşmuyor. Forumdaki paylaşımlarımızı kolaylaştırmak için İngilizceyi ortak dil olarak seçtik. Lütfen bize İngilizce yazın veya bir Elektronik Çevirmen kullanın, bir sonraki ziyaretinizde cevabım için Google Translate kullandım. Hello esmotomasyon; The Siemens forum brings together participants from all over the world, and they do not all speak the same language. We have chosen English as a common language to facilitate our exchanges on the forum. Please write to us in English (or use an Electronic Translator, I used Google Translate for my answer) on your next visit. The conversion of a 16-bit value to 16 individual bits uses the AND logical operator in a script. In WinCC (TIA Portal) you would need to use a script that takes the int value and mask each bit with a logical AND to 1, which would give you the status of one particular bit, the lowest (first). You must then repeat the same int AND 2 to examine the status of the next bit, then the int AND 4 for the 3rd bit... The C-script shown in the following link has been developed for WinCC v7 (not TIA Portal) but it explains well how to use 16 masking AND calls to retrieve 16 boolean values that you can use in your program. - Unpack Word to bool in WInCC project A similar VBS-script designed in WinCC TIA Portal shows how to use similar masks to unpack a Dword value (32 bits), then use these Bool values in further operations:; you can of course modify it to examine 16 bits only - What do you have to pay attention to in VBScript when linking tags bit by bit and how do you set the highest value bit (Bit 31/Bit 32) in WinCC with VBS? https://support.industry.siemens.com/cs/pe/en/view/27039111 Hope this helps, Daniel Chartier |
Last edited by: dchartier at: 02/20/2021 15:51:05 |
|
This contribution was helpful to
1 thankful Users |
Follow us on