Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sat Nov 18, 2017 11:50 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Aug 08, 2011 8:22 pm 
Offline
User avatar

Joined: Thu Jun 14, 2007 9:05 am
Posts: 98
Location: Montreal - PQ
I am reading some MBTCP data and they are Integers.

For instance, a value of 300 would mean 30.0 seconds

I can I display them the way I want?

Whenever I add decimal places in Integers readings they just add two zeros at the end...

Maybe there is a quick trick to do this without reverting to virtual memory and maths... like other HMI can.

Thanks guys.

_________________
If it looks like a Cat ...


Top
 Profile  
 
PostPosted: Tue Aug 09, 2011 7:51 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
I would use a LabelV2 and a MBVirtualRegister. The MBVirtualRegister will edit and copy the value to the label. The code might look something like this.

Code:
init commobj := modbuscomm
init parent := default
init register := 1

func ValueChanged()
    dim f as float

    f := value / 100
    Label_1.value = _FormatFloat(f, 0, 2, _FLOAT_NORMAL)
endfunc

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
PostPosted: Tue Aug 09, 2011 8:25 am 
Offline
User avatar

Joined: Thu Jun 14, 2007 9:05 am
Posts: 98
Location: Montreal - PQ
Thanks Ron,

I am using a MB tachometer so that formated value will be the value of a TachometerV2 object.

This makes senses?

Now the other way around... to Set the value, with a keypad???

_________________
If it looks like a Cat ...


Top
 Profile  
 
PostPosted: Tue Aug 09, 2011 9:25 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
Assuming you are talking about a number keypad. You could use a "NumberKeypadV2" and a "MBVirtualRegister". The code in the NumberKeypad will look like this.

Code:
init parent := default
init xpos := 160
init ypos := 40
init width := 210
init height := 260

func EnterPressed()
    MBVirtualRegister_1.value = me.value * 100
endfunc

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group