Notifications
Clear all

Programing

6 Posts
3 Users
0 Likes
11.3 K Views
(@alphay)
Trusted Member
Joined: 13 years ago
Posts: 65
Topic starter  

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)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

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)
Trusted Member
Joined: 13 years ago
Posts: 65
Topic starter  

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

Thanks
Alpha


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

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)
Eminent Member
Joined: 12 years ago
Posts: 29
 

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

tnks


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

Standard cast in C, e.g.

float value = *(float*)(datapointer)

   
ReplyQuote
Share: