Interfacing AD9833 with SPI protocol with PIC18F2550 Problem

Maar dat lukt beslist nog wel...

Postby steven33 » Sat Feb 28, 2009 12:00 am

Hey Everbody

It's about over to interface my AD9833 (DDS chip) with the microcontroller PIC18F2550

The AD9833 chip makes SPI communication possibly with an microcontrollers and give me the next connections:

FSYNC : Active Low Control Input.
This is the frame synchronization signal for the input data.
When FSYNC is taken low, the internal logic is informed that a new word is being loaded into the device.

SDATA: Serial Data Input. The 16-bit serial data-word is applied to this input
SCLK : Serial Clock Input. Data is clocked into the AD9833 on each falling SCLK edge.

The PIC18F2550 have the next connections:
=================================
SCK : Synchronous serial clock input/output for SPI mode
SDI : SPI data in (input)
SDO : SPI data out (output)

Qestion 1
=======

How can I connected my AD9833 via SPI communication with my microcontroller PIC18F2550 ?
I have been connected my AD9833 with my PIC18F2550 in this order:

AD9833 Device Microcontroller Device
============ ================
SCLK (input) SCK (output)
FSYNC (input) SDO (output)
SDATA (input) SDI (input)

If it's not possible to connected in this way, is there then an alternative manner because I'm going one using my
current devices normally the AD9833 and the PIC18F2550 because both they support SPI protocol

Question 2
========
In which mode can I the I/O pins for the data communication SPI?

Question 3
=======

If somebody examples of SPI communication in Master en Slave mode?
steven33
 
Posts: 24
Joined: Thu Jan 02, 2014 3:31 pm

Postby schueler » Sat Feb 28, 2009 12:00 am

The answer to your questions are in the datasheet of this AD9833.
The AD9833 does not support SPI, however you can use the SPI interface to set the AD9833. Please check the datasheet page 15 and 16 AD9833 to 68HC11/68L11 Interface.

AD9833 Device Microcontroller Device
============= ================
SCLK (input) SCK (output)
FSYNC (input) PC7 (output)
SDATA (input) MOSI (output)


PC7 ( used to control FSYNC ) is a I/O port that has to be set low and high manually.
As you can see, you can only write to the AD9833.


Ben'
schueler
 
Posts: 1433
Joined: Thu Jan 02, 2014 10:40 am

Re: Interfacing AD9833 with SPI protocol with PIC18F2550 Pro

Postby sulochana » Sat Jun 10, 2017 6:48 am

Hi Everyone,

i am able to generate frequency in sine,square and triangle waveforms and also able to sweep frequency .But problem arised during sweeping frequency with step of 0.001 Hz.i am using freqreg0.

For Example:
Formula i used :
freq reg=(fout freq * 2^28)/25Mhz.

fout freq freq reg hex val
10.001 107.384919 6B
10.002 107.395657 6B
etc.....

wave.MSB =(int)( 0x4000 | (int)((freq_reg & 0xFFFC000) >> 14)); //Only lower 14 bits are used for data
wave.LSB =(int)( 0x4000 | (int)(freq_reg & 0x3FFF));

GPIOB_OFF_BIT(12); //chip select bit is OFF
delay(5000);
AD9833_write((wave.LSB )); // Write lower 16 bits to AD9833 registers
AD9833_write((wave.MSB )); // Write upper 16 bits to AD9833 registers.
AD9833_write(0xC000); // Phase register
AD9833_write(wave.waveform); // Exit & Reset to SINE, SQUARE or TRIANGLE
delay(5000);
GPIOB_ON_BIT(12);

By seeing example hope it understand .Problem is while freq reg value is converting to hex its considering only integer part but fraction part is ignoring.
so in this case 0.001 hz step frequency is difficult.how do i send frequency with 0.001hz step freq

so, i need solution to overcome with issue.please help me its urgent.

Thank you.
sulochana
 
Posts: 1
Joined: Sat Jun 10, 2017 6:39 am


Return to Mijn schakeling werkt nog niet...

Who is online

Users browsing this forum: No registered users and 1 guest