tssing Posted June 24, 2008 Share Posted June 24, 2008 To.Ulong({{0,0,0x60,0xc0}})correct Private.c[0]=0 c[1]=0 c[2]=0x60 c[3]=0xc0 To.Ulong({{c[0],c[1],c[2],c[3]}})//error To.Ulong({{0,0,StrToDouble("0x60"),0xc0}})//error Please check it .. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 25, 2008 Share Posted June 25, 2008 You cannot put expressions inside of {}, only constants. If you have a variable loaded, you would just do: To.ULong(c) Link to comment Share on other sites More sharing options...
tssing Posted July 9, 2008 Author Share Posted July 9, 2008 I use the example of statement Link to comment Share on other sites More sharing options...
tssing Posted July 10, 2008 Author Share Posted July 10, 2008 I think you no read usersguide.pdf....I use example of this file.... Link to comment Share on other sites More sharing options...
tssing Posted July 10, 2008 Author Share Posted July 10, 2008 I very angry..You every day give me many execuse...And not help to me... Link to comment Share on other sites More sharing options...
AzeoTech Posted July 10, 2008 Share Posted July 10, 2008 Actually, I wrote the user guide, so I can assure you I have read it many times. No where does it say that you can use variables inside of {} notation. Only constants are allowed: OK: {{1,2,3,4}} NOT OK: {{C[0],c[1],c[2]}} On page 44 of the users guide it says exactly this: Only numbers and commas are allowed between the {}, but these numbers can be in hex or binary format using the appropriate delimiter described a little later. What you want is simply this: Private.c[0]=0 c[1]=0 c[2]=0x60 c[3]=0xc0 To.Ulong(c) because c contains the whole array already. Link to comment Share on other sites More sharing options...
tssing Posted July 10, 2008 Author Share Posted July 10, 2008 Only constants are allowed....... I think this function not good for used. Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11, 2008 Share Posted July 11, 2008 I think you are misunderstanding. Only constants are allowed inside the {} notation. This is identical to C / C++ (except C has #defines, which DAQFactory does not). In the To.ULong() function you can use variables all you want. The primary use is for parsing serial data. So, if you were reading 4 bytes from the serial port into a string that specify an unsigned 32 bit value, you could do: private string datain = Device.myserial.read(4) // read 4 bytes private val = to.Ulong(asca(datain)) The asca() function converts a string into an array of bytes. So, asca("abcd") returns {97,98,99,100}. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.