@@ -29,21 +29,12 CMD_RESET =0X01 | |||||
29 | CMD_ENABLE =0X02 |
|
29 | CMD_ENABLE =0X02 | |
30 | CMD_CHANGEIP =0X03 |
|
30 | CMD_CHANGEIP =0X03 | |
31 | CMD_STATUS =0X04 |
|
31 | CMD_STATUS =0X04 | |
|
32 | CMD_DISABLE =0X02 | |||
32 | CMD_ECHO =0XFE |
|
33 | CMD_ECHO =0XFE | |
33 |
|
34 | |||
34 |
|
|
35 | RC_CMD_RESET =0X10 | |
35 | DDS_CMD_ENABLE_RF =0x11 |
|
36 | RC_CMD_WRITE =0x50 | |
36 | # DDS_CMD_MULTIPLIER =0X12 |
|
37 | RC_CMD_READ =0x8000 | |
37 | # DDS_CMD_MODE =0x13 |
|
|||
38 | # DDS_CMD_FREQUENCY_A =0X14 |
|
|||
39 | # DDS_CMD_FREQUENCY_B =0x15 |
|
|||
40 | # DDS_CMD_PHASE_A =0X16 |
|
|||
41 | # DDS_CMD_PHASE_B =0x17 |
|
|||
42 | # DDS_CMD_AMPLITUDE_1 =0X19 #Se han invertido la posicion de los canales |
|
|||
43 | # DDS_CMD_AMPLITUDE_2 =0x18 #en el PCB |
|
|||
44 |
|
||||
45 | DDS_CMD_WRITE =0x50 |
|
|||
46 | DDS_CMD_READ =0x8000 |
|
|||
47 |
|
38 | |||
48 | @eth_device(ID_CLASS) |
|
39 | @eth_device(ID_CLASS) | |
49 | def reset(): |
|
40 | def reset(): | |
@@ -82,12 +73,12 def read_all_device(): | |||||
82 |
|
73 | |||
83 | payload = "" |
|
74 | payload = "" | |
84 |
|
75 | |||
85 |
return |
|
76 | return CR_CMD_READ, payload | |
86 |
|
77 | |||
87 | @eth_device(ID_CLASS) |
|
78 | @eth_device(ID_CLASS) | |
88 | def write_all_device(payload): |
|
79 | def write_all_device(payload): | |
89 |
|
80 | |||
90 |
return |
|
81 | return CR_CMD_WRITE, payload | |
91 |
|
82 | |||
92 | def read_config(ip, port): |
|
83 | def read_config(ip, port): | |
93 | """ |
|
84 | """ | |
@@ -114,6 +105,28 def write_config(ip, port, parms): | |||||
114 |
|
105 | |||
115 | return answer |
|
106 | return answer | |
116 |
|
107 | |||
|
108 | def __get_low_byte(valor): | |||
|
109 | ||||
|
110 | return ord(valor & 0x00FF) | |||
|
111 | ||||
|
112 | def __get_high_byte(valor): | |||
|
113 | ||||
|
114 | return ord((valor & 0xFF00) >> 8) | |||
|
115 | ||||
|
116 | @eth_device(ID_CLASS) | |||
|
117 | def write_ram_memory(vector_valores, vector_tiempos): | |||
|
118 | ||||
|
119 | l1 = len(vector_valores) | |||
|
120 | l2 = len(vector_tiempos) | |||
|
121 | ||||
|
122 | cad = "" | |||
|
123 | ||||
|
124 | for i in range(l1): | |||
|
125 | cad += ord(84) + __get_low_byte(vector_valores[i]) + ord(85) + __get_high_byte(vector_valores[i]) + \ | |||
|
126 | ord(84) + __get_low_byte(vector_tiempos[i]) + ord(85) + __get_high_byte(vector_tiempos[i]) | |||
|
127 | ||||
|
128 | return RC_CMD_WRITE, cad | |||
|
129 | ||||
117 | if __name__ == '__main__': |
|
130 | if __name__ == '__main__': | |
118 | ip = "10.10.20.150" |
|
131 | ip = "10.10.20.150" | |
119 | port = 2000 |
|
132 | port = 2000 |
General Comments 0
You need to be logged in to leave comments.
Login now