I would like to post a topic of writing the interface code for several DDS chips (Analog Devices). At this point I am having problems using the AD9834 would appreciate any help on this.
Thanks
JAE
Interfacing a DDS chip
Re: Interfacing a DDS chip
How can we help? Do you have any specific problems or questions?
I think the best starting point is reading the datasheet for the chip in question -- have you already tried this?
I think the best starting point is reading the datasheet for the chip in question -- have you already tried this?
Re: Interfacing a DDS chip
I have reviewed the specification. I am having a problem with shifting data into the control registrar. Any help would be appreciated..
Re: Interfacing a DDS chip
So what do you have so far, and how the problem manifests itself?
Re: Interfacing a DDS chip
Here is my initial code for the serial registrar.
def shift16():
for i in range(16) #loop for 16 data bits
value = data & 0x8000 #look at left-most bit
SetPin (SDAT, Value) #puts its value on data line
data <<=1 #shift data bit to left
data &=0xFFFF #limit data to 16 bits
toggle sclk() #clock in the data bit_length
FSYNC.high() #bring FSYNC high after word sent
I am particularly concerned about the syntax,
Thanks JAE
def shift16():
for i in range(16) #loop for 16 data bits
value = data & 0x8000 #look at left-most bit
SetPin (SDAT, Value) #puts its value on data line
data <<=1 #shift data bit to left
data &=0xFFFF #limit data to 16 bits
toggle sclk() #clock in the data bit_length
FSYNC.high() #bring FSYNC high after word sent
I am particularly concerned about the syntax,
Thanks JAE
Re: Interfacing a DDS chip
I guess to learn Python's syntax it's best to start with the official tutorial: https://docs.python.org/3/tutorial/
For sending data to that chip, you would probably be best off using the SPI peripheral: http://docs.micropython.org/en/latest/p ... e.SPI.html
For sending data to that chip, you would probably be best off using the SPI peripheral: http://docs.micropython.org/en/latest/p ... e.SPI.html
Re: Interfacing a DDS chip
I having a problem getting this going. I am particular concerned about the code that I sent you. DO you see anything just glaringly wrong.
I must confess i am principally a hardware person. I am certainly not a code writer. Any examples you could send would help a great deal.
Particularly the code that I sent if you could point out what I am doing wrong it would be much appreciated.
Thanks
Jim
I must confess i am principally a hardware person. I am certainly not a code writer. Any examples you could send would help a great deal.
Particularly the code that I sent if you could point out what I am doing wrong it would be much appreciated.
Thanks
Jim
Re: Interfacing a DDS chip
The code you posted doesn't make any sense, it's certainly not Python, and it doesn't use the commands that MicroPython makes available. Have you looked at the links I gave you? Try to write your code using the functions that are described there, and not just invent your own names and hope they somehow magically work.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Interfacing a DDS chip
Indeed. I'd start by learning the language using standard Python 3.x or MicroPython on a PC and working through a tutorial text. When you've got to grips with the language syntax, then move to hardware-oriented code on a Pyboard. It really is much quicker to do it that way.
Don't use Python 2.x as significant differences appeared with V3. MicroPython has always been 3.x compliant.
Don't use Python 2.x as significant differences appeared with V3. MicroPython has always been 3.x compliant.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.