BCD conversation

BCD conversation

Hi,
I have to convert BCD numbers to integer or to double.
I've writen the code. It works, but it's very slow.
16 conversation takes more hthen 1 minute.
1. Why is it too slow?
2. How can I make the conversation?
3. Any other solution?
the present code:
Dim x0, x1, x2, x3, x4, x5, x6, x7 As Integer
Dim BCD_f, BCD_a As Variant

BCD_f = obProject.Variables.Item("9533_FW_OSSZ_M3_BCD_F").Value
x3 = BCD_f And 61440
x2 = BCD_f And 3840
x1 = BCD_f And 240
x0 = BCD_f And 15
BCD_a = obProject.Variables.Item("9534_FW_OSSZ_M3_BCD_A").Value
x7 = BCD_a And 61440
x6 = BCD_a And 3840
x5 = BCD_a And 240
x4 = BCD_a And 15
x4 = x4
x5 = (x5 / 16) * 10
x6 = (x6 / 256) * 100
x7 = (x7 / 4096) * 1000
x0 = x0 * 10000
x1 = (x1 / 16) * 100000
x2 = (x2 / 256) * 1000000
x3 = (x3 / 4096) * 10000000

obProject.Variables.Item("9533_D_OSSZ_M3").Value = x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7
Thank you
vpapp

This is a migrated post! Originally posted on 07.03.2012 by user markoszoft. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com