Charmed Quark Systems
Google
WWW CharmedQuark.com

Go Back   Charmed Quark Systems > General Discussion > Beta Driver Development
Register FAQ Members List Calendar Mark Forums Read

Beta Driver Development Discussion of new drivers, finding someone to write a new driver, etc...

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-13-2012, 11:49 PM
pjgregory pjgregory is offline
 
Join Date: Aug 2004
Location: Montepulciano, Italy
Posts: 525
Default Problem with a PDL driver

I am writing a PDL driver for my energy analyzer. The data from the internal registers is returned in binary rather than ASCII format with two sequential bytes representing the MSB and LSB or a 16bit signed Integer. What is the easiest way to convert these to an INT4 field in the "Store=" structure?

So far the only thing that works is (for bytes 3 and 4 in the reply)

Store=
Register1 = Add(Mul(ToInt4(Extract(&Reply, Card1, 3)), 256) ,Extract(&Reply, Card1, 4));
EndStore;

This seems long winded and I am not sure yet if it will work for negative numbers. Is there a better way?

PJG
Reply With Quote
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:12 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.