Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

HELP on PIC PROGRAMING with AD9850 SIGNAL GENERATOR

Status
Not open for further replies.

gentxtelmer2003

Junior Member level 1
Joined
Jun 27, 2005
Messages
16
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,475
ad9850 bascom

we are having hard time in writting the program in PIC together with the AD9850 which is a programable waveform generator IC.

The components of the Project are:


(3x4)KEYPAD - TO input the DESIRE frequency in HERTZ.
(HD44780)LCD - Display the FREQUENCY INPUTED in the KEYPAD.
AD9850 - the programable waveform generator IC from analog devices.


requirements:
max freq = 5MHz
frequency resolution of = 1Hz


The AD9850 is connected in parrallel with the PORT D of the PIC16F877A with a 20Mhz Clock. The reference clock of the AD9850 is 50MHz. The IC is 40bit programable.


If we input a certain frequency in the keypad it will generate a 40bit code for it to be loaded in the AD9850 also at the same time it will display the inputed frequency in the LCD display.


Help us in writting the program.
 

dds vfo with pic16f84 and ad9850

And your programming language is? Looks like you're beginner at PIC, so why don't you search the internet for the same, already functioning, projects?
 

ad9850 filter

programing language is C.

im a newbie in this pic hobby.
 

ad9850 pic

im using Microchip MPLAB IDE for programming and HI-TECH PICCLITE compiler... we will will load the tuning word for the AD9850 five times in 8-bit parallel with PORTD.. how are we going to load a value 0xFFFFFFFF(32bits) in four 8 bits.. bit31-bit23 will be loaded first..
 

frequency generator bascom

problems also with the keypad input and LCD display..

Added after 2 minutes:

we are using a 50Mhz reference clock for the AD9850 and our PIC16F877A uses 20MHz...
 
ad9850 tuning word

I am also starting same type of projects using AD9850 and PIC. But my output frequency will be different. Where are you from Mr. gentxtelmer2003. Can you PM me.
 

ad9850 pic16f877a

gentxtelmer2003 said:
how are we going to load a value 0xFFFFFFFF(32bits) in four 8 bits.. bit31-bit23 will be loaded first..

The AD9850 contains a 40-bit register that is used to program the 32-bit frequency control word.
You have a value stored in 32-bit variable that have to be sent to the 40-bit register of AD9850.
Probably you're in doubt where the 8-bit difference is coming from. It's one byte which includes 5-bit phase modulation, 1-bit power-down function and 2-bit factory reserved codes.
And this is the first byte among 5 that must be loaded first, followed by the rest of 4 meaning the frequency.

In order to load 5 bytes into 40-bit register you have to raise the level of pin 8 (FQ_UD) to "1" logic. That will reset the address pointer to the first register inside AD9850.
Reset to "0" the pin 8.
Now, load the PORTD with the first byte W0 which contains the phase, power-down and control bits as explained above and give a pulse 0 -> 1 -> 0 on pin 7 (W_CLK).
This will load the byte into 40-bit register and move the pointer to the next register.
Load the PORTD with b31-b24 and give another pulse on pin W_CLK.
and so on up to the fifth and last byte.
Finnaly raise again to "1" logic the pin (FQ_UD), then back to "0". After 18 clock cycles (on CLKIN) the frequency will be updated.

Because PIC16F877 is an 8-bit microcontroller, your 32-bit variable is stored in four concatened registers.
I'm confident that you know how to split in C such kind of variable in order to load the 8-bit PORTD, four subsequent times.

You can see a similar project with 4x4 keyboard, LCD and DDS here:
https://www.qsl.net/pa3ckr/signalgenerator/index.html
but wrote in assembler for PIC16F84 and AD9850 loaded serial rather than parallel.
 

ad9850

Mr. silvio thanks for nice description about AD9850 and other info. I want to know from where I will get optical rotary encoder for this project.
 

ad9850 c source code

Code Warrior said:
I want to know from where I will get optical rotary encoder for this project.

From the same author : https://www.qsl.net/pa3ckr/bascom and avr/encoders/index.html

He starts with a Bourns ECW1J-B24-AC0024 contacting encoder with a rotational life of 200,000 shaft revolutions, 24 cycles/revolution and 120 RPM

Then he tried an optical encoder (needless contact bounce and increased rotational life) from Agilent.

However, you can use any industrial encoder with A/B output and resolution according to your needs.
 

bascom source code ad9850

Thanks silvio for the information. Actually I am making DDS based VFO for HAM purpose. May be you aware of HAM radio. There for I need more info and help in this direction. If possible PM me.
 

ad9850 signal generator

silvio:
Because PIC16F877 is an 8-bit microcontroller, your 32-bit variable is stored in four concatened registers.
I'm confident that you know how to split in C such kind of variable in order to load the 8-bit PORTD, four subsequent times.


sir, this is our problem.. we do not know how to split in C such kind of variable.
 
ad9850 applications

naj.cuizon said:
we do not know how to split in C such kind of variable.

Code:
unsigned long tuning_freq;               
unsigned long temp;                            
unsigned char your_PORTD; 

temp = tuning_freq & 0xFF000000;                         
your_PORTD = temp >> 24;  /* your_PORTD variable contains now bits b31-b24 */

temp = tuning_freq & 0x00FF0000;
your_PORTD = temp >> 16;  /* your_PORTD variable contains now bits b23-b16 */

temp = tuning_freq & 0x0000FF00;
your_PORTD = temp >> 8;  /* your_PORTD variable contains now bits b15-b8 */

temp = tuning_freq & 0x000000FF;
your_PORTD = temp;       /* your_PORTD variable contains now bits b7-b0 */
 

programming ad9850

thank you so much! you've been very helpful.. i'll try this one..
 
ham radio ad9850 signal generator

silvio:

Probably you're in doubt where the 8-bit difference is coming from. It's one byte which includes 5-bit phase modulation, 1-bit power-down function and 2-bit factory reserved codes.

Sir, we would like to ask wat would be the value for the 5-bit phase modulation and 1-bit power-down function. it is not found in the datasheet. only the 2-bit factory reserved codes can be found (01 or 10).
 
https://www.analog.com/UploadedFiles/Data_Sheets/34008438159094AD9850_h.pdf
Figure 8 and 9 from page 11 shows effects of writing XXXXX100 and XXXXX000 data W0 as internal clocks are disabled and enabled accordingly.
On bottom of page 1, first column :
The device also provides five bits of digitally controlled phase modulation, which enables phase shifting of its output in increments of 180°, 90°, 45°, 22.5°, 11.25°, and any combination thereof.
For 0° phase shifting, W0 = 00000000
For 11.25°phase shifting, W0 = 00001000
For 180° W0 = 10000000
For 191.25° W0 = 10001000 and so on.
 

Code Warrior said:
Actually I am making DDS based VFO for HAM purpose. May be you aware of HAM radio. There for I need more info and help in this direction. If possible PM me.
The 2006 ARRL Handbook describes several DDS applications and construction projects for ham radio.
https://www.arrl.org/catalog/9485/
 

Mr. echo47 you have ARRL hand book in PDF format? Can you send me that.
 

I made this simple test program using MPLAB IDE from Microchip with HiTech PICCLite Compiler. This didn't work in our hardware testing. We wanted to use parallel loading method of loading the values to the AD9850 from the PIC16F877A with RC2 as FQ_UD, RC3 as W_CLK and all the 8pins of PORTD as one to contain the DATA. pls comment and i welcome suggestions/corrections.


#include<pic.h>
#include<delay.h>
#include<delay.c>


void main(void)
{
TRISC=0x00;
PORTC=0x00;
TRISD=0x00;
PORTD=0x00;

DelayMs(200); //set a delay of 200ms

RC2=0; DelayUs(4); RC2=1; DelayUs(4); RC2=0; DelayUs(3); //RC2-FQ_UD, RC3-W_CLK
PORTD=0x00; DelayUs(1); RC3=1; DelayUs(2); RC3=0; DelayUs(1); //W0 control - 00 (or 11)
// power-down - 0 (internal clocks enabled
PORTD=0x00; DelayUs(1); RC3=1; DelayUs(2); RC3=0; DelayUs(1); //W1 b31-b24 tuning word
PORTD=0x83; DelayUs(1); RC3=1; DelayUs(2); RC3=0; DelayUs(1); //W2 b23-b16
PORTD=0x12; DelayUs(1); RC3=1; DelayUs(2); RC3=0; DelayUs(1); //W3 b15-b8
PORTD=0x6E; DelayUs(1); RC3=1; DelayUs(2); RC3=0; DelayUs(2); //W4 b7-b0
RC2=1; DelayUs(4); RC2=0; DelayUs(4);

for(;;); //loop forever

}
 
hi,

I did a few years back exactly the thing you're trying to build. I used pic16f877 + ad9850 + hi-tech picc compiler.

I used this function to load the DDS (4MHz clock):

void send2dds()
{
unsigned char data;
dds_fqud=0;
dds_wclk=0;
data=0;
PORTD=data;
dds_wclk=1;
dds_wclk=0;

data=word >> 24;
PORTD=data;
dds_wclk=1;
dds_wclk=0;

data=word >> 16;
PORTD=data;
dds_wclk=1;
dds_wclk=0;

data=word >> 8;
PORTD=data;
dds_wclk=1;
dds_wclk=0;

data=word;
PORTD=data;
dds_wclk=1;
dds_wclk=0;
dds_fqud=1;
PORTD=0;
}

hope it helps ;)
 

Another thing is we are using a keypad as input and there we input a decimal value. How do we convert a DEC value to HEX in C?

Ex:
temp = tuning_freq & 0xFF000000;
your_PORTD = temp >> 24;

the tuning_freq has to be HEX, right?? our program takes what is inputed as DEC.. therefore, we hav to convert the input value to HEX in order to be manipulated, right?? really need guidance on this..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top