[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] DBSRx set gain code
From: |
Lee Patton |
Subject: |
[Discuss-gnuradio] DBSRx set gain code |
Date: |
Mon, 12 Dec 2005 19:52:25 -0500 |
I don't understand why the gain range returned by the DBSRx ranges from
0 to 104 when the PGA gives only 0 to 20 dB. Obviously, the answer lies
in db_dbs_rx.py, but I haven't a clue as to what the code is really
doing. Can anyone (Eric) explain? I read about Registers 2/3 in the
AD9862 data sheet, but I couldn't correlate that information with the
code.
Also, I found gnuradio-core/doc and usrp/doc. Is there any more code
documentation that I am not aware of?
Thanks,
- Lee
181 # Gain setting
182 def _set_dl(self,dl):
183 assert dl == 0 or dl == 1
184 self.dl = dl
185 self._send_reg(4)
186
187 def _set_gc2(self,gc2):
188 assert gc2<32 and gc2>=0
189 self.gc2 = gc2
190 self._send_reg(5)
191
192 def _set_gc1(self,gc1):
193 assert gc1>=0 and gc1<4096
194 self.gc1 = gc1
195 self._u.write_aux_dac(self._which,0,int(gc1))
196
197 def _set_pga(self, pga_gain):
198 assert pga_gain >=0 and pga_gain <=20
199 if(self._which == 0):
200 self._u.set_pga (0, pga_gain)
201 self._u.set_pga (1, pga_gain)
202 else:
203 self._u.set_pga (2, pga_gain)
204 self._u.set_pga (3, pga_gain)
205
206 def gain_range(self):
207 return (0, 104, 1)
208
209 def set_gain(self,gain):
210 if not (gain>=0 and gain<105):
211 raise ValueError, "gain out of range"
212 gc1 = 0
213 gc2 = 0
214 dl = 0
215 pga = 0
216 if gain <56:
217 gc1 = int((-gain*1.85/56 + 2.6)*4096/3.3)
218 gain = 0
219 else:
220 gc1 = 0
221 gain = gain - 56
222 if gain < 24:
223 gc2 = int(round(31 * (1-gain/24)))
224 gain = 0
225 else:
226 gc2 = 0
227 gain = gain - 24
228 if gain >= 4.58:
229 dl = 1
230 gain = gain - 4.58
231 pga = gain
232 print "Gain %f" % pga
233 self._set_gc1(gc1)
234 self._set_gc2(gc2)
235 self._set_dl(dl)
236 self._set_pga(pga)
237
- [Discuss-gnuradio] DBSRx set gain code,
Lee Patton <=