AGG Software Forums
November 25, 2024, 02:31:44 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome on our forum!
 
   Home   Help Search Login Register  

Pages: [1]
  Print  
Author Topic: Hex to Decimal Conversion  (Read 29482 times)
Rodger
Jr. Member
**

Karma: +0/-0
Posts: 5


View Profile
« on: April 15, 2011, 12:53:23 PM »

Hello

I'm using Advanced Serail data Logger and I'm parsing my data so I get a 5 digit ascii string in hex format:

03C4A6
03BC40
03E094
03F462
040952
03FBB0
03CC9E
039648
0357A0
033B44
032514

I would like to convert this to a decimal no. and then divide by 1000.  I've tried the Expression plugin but can't see any functions that would do hex to dec part of  this.  I've tried various of the conversion functions but they talk about arrays and my data  is a string not an array.  Is it possible to do this within the logger and if so a solution would be much appreciated.

Thankyou.

Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #1 on: April 15, 2011, 03:42:51 PM »

Did you configure the ASCII Data Parser plugin to extract a single value? If yes, then please, download the update for the Expressions plugin and use the following expression:

Code:
VALUE2=HEXSTRTODEC(VALUE)/1000

http://www.aggsoft.com/download/expressions.exe
Logged
Rodger
Jr. Member
**

Karma: +0/-0
Posts: 5


View Profile
« Reply #2 on: April 15, 2011, 08:01:50 PM »

I found the function, thanks.  However I can't get the variable I declare in the expression plugin to show in the DDE output.  I've tried different expressions and none show up so I must be doing something fundamentally wrong.

I've attached a jpg showing how I've configured all the relevant screens. I hope you can help.



* advserialgrabs.jpg (207.48 KB, 480x1979 - viewed 10 times.)
Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #3 on: April 15, 2011, 10:02:57 PM »

This is a bug in your version. Therefore, I've suggested to update the plugin.
Logged
Rodger
Jr. Member
**

Karma: +0/-0
Posts: 5


View Profile
« Reply #4 on: April 15, 2011, 10:15:14 PM »

I've updated the logger as suggested, checked I'm on the latest version of the plugin and it still doesn't work.
Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #5 on: April 15, 2011, 10:24:52 PM »

Please, remove spaces around "=".
Logged
Rodger
Jr. Member
**

Karma: +0/-0
Posts: 5


View Profile
« Reply #6 on: April 15, 2011, 10:39:04 PM »

OK

I've now got the expression appearing in the DDE  Smiley, I had to stop and start the logger before the changes worked.

VAR1=HEXSTRTODEC(PDRDATA)

works fine.

However,

VAR1=HEXSTRTODEC(PDRDATA)/1000

VAR1=(HEXSTRTODEC(PDRDATA))/1000

don't work.

Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #7 on: April 16, 2011, 10:31:34 AM »

It works in my case Smiley


* s1.png (33.38 KB, 468x372 - viewed 7 times.)
Logged
Rodger
Jr. Member
**

Karma: +0/-0
Posts: 5


View Profile
« Reply #8 on: April 16, 2011, 06:20:02 PM »

Fixed it here too.

Under the DDE settings tab the Number format was selected and set at 990.00, this was translating to the DDE number output for the Expression.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines