Programing  

  RSS

alphay
(@alphay)
Trusted Member
Joined: 9 years ago
Posts: 65
13/03/2012 1:15 pm  

Hi

Q: we send the command for reading the environments parameter. But the response code is unknowed.

200100 – 0x20 start frequency 0100 - ID1 - 01 , ID2 -00 send command
But the response is 00C0D544, we don’t know what is the frequency in MHz ?

Val 1 – 00
Val 2- C0
Val 3 – D5
Val 4 - 44

Please let us know what is the rule from 00C0D544 to MHz ??

As we send the command code 0100 ( START FREQUENCY ) ,the return code from buffer is 00C0D544.
PLEAse
let me know what is the start frequency? how to caculate it ?

WHat it mean from 00C0D544 to MHz?

ANd please let me know how to know the rule from MHz to 4 Bytes code ?
For example , if we want to program in startfrequency 100MHz , what is the parameter for Val 1 -Val 4 ?

Do you have any documents or example code to give us the idea for the transfer from MHz to 4 bytes code?

Thanks

Alpha


Quote
mm_dev
(@mm_dev)
Member Admin
Joined: 9 years ago
Posts: 287
13/03/2012 1:37 pm  

As stated in the documentation variable values are passed as 32 bit IEEE 754 floating point values using little endian byte order.
For your example you first have to reverse the byte order to 0x44d5c000, then interpret it as 32 bit float value (standard cast in C), resulting in a value of 1710.0 (the unit of the value is depending on the device).


ReplyQuote
alphay
(@alphay)
Trusted Member
Joined: 9 years ago
Posts: 65
13/03/2012 11:55 pm  

Hi
For RBW and VBW command code, are the return bytes all the same as the rule 32bites ?

Thanks
Alpha


ReplyQuote
mm_dev
(@mm_dev)
Member Admin
Joined: 9 years ago
Posts: 287
14/03/2012 8:05 am  

Values are always passed as 32 bit floats, but for RBW and VBW you don't specify the frequency directly, but use an index value to select from a table of available filters (see Spectran API documentation for possible values).


ReplyQuote
ronaldinho
(@ronaldinho)
Eminent Member
Joined: 8 years ago
Posts: 29
27/03/2012 10:59 am  

How can i interpret 4 bytes as 32 bit float value?
Do you have any example code ?

tnks


ReplyQuote
mm_dev
(@mm_dev)
Member Admin
Joined: 9 years ago
Posts: 287
28/03/2012 9:13 am  

Standard cast in C, e.g.

float value = *(float*)(datapointer)

ReplyQuote
Share: