To whom it may concern,
I am using launchpad Picollo C2000 Launchpad Evaluation Kit - Launchxl F28027.
I want to drive the Direct Digital Synthesizer wit this MCU.
The following code is for the ARDUINO, and it works:
#define W_CLK 8 // Pin 8 - connect to AD9851 module word load clock pin (CLK)
#define FQ_UD 9 // Pin 9 - connect to freq update pin (FQ)
#define DATA 10 // Pin 10 - connect to serial data load pin (DATA)
#define RESET 11 // Pin 11 - connect to reset pin (RST).
#define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); }
// transfers a byte, a bit at a time, LSB first to the 9851 via serial DATA line
void tfr_byte(byte data)
{
for (int i=0; i<8; i++, data>>=1) {
digitalWrite(DATA, data & 0x01);
pulseHigh(W_CLK); //after each bit sent, CLK is pulsed high
}
}
// frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32
void sendFrequency(double frequency) {
int32_t freq = (frequency * 4294967296.0)/(180.0e6 * 0.1626); // note 180 MHz clock on 9851
for (int b=0; b<4; b++, freq>>=8) {
tfr_byte(freq & 0xFF);
}
tfr_byte(0x000); // Final control byte, all 0 for 9851 chip
pulseHigh(FQ_UD); // Done! Should see output
}
void setup() {
// configure arduino data pins for output
pinMode(FQ_UD, OUTPUT);
pinMode(W_CLK, OUTPUT);
pinMode(DATA, OUTPUT);
pinMode(RESET, OUTPUT);
pulseHigh(RESET);
pulseHigh(W_CLK);
pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10
}
void loop() {
sendFrequency(100.0e3); // freq
while(1);
}
I need the same code but for the CCS. Also, could you help me with pinning, please.
I tried a lot of ways; they dont work. I do not know what to do.
Thank you very-very much!!!