Skip to content

Commit

Permalink
Part ID read and Frequency setting successful on chip
Browse files Browse the repository at this point in the history
  • Loading branch information
chiranthsiddappa committed Apr 18, 2014
1 parent b2b277f commit f1a3f75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 5 additions & 4 deletions AD9912_sketch/AD9912.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ uint64_t AD9912::instruction(short command, uint16_t address, char bytes, uint64
return 0;
instruction |= command << 15;
instruction |= address & 0x7FF;
Serial.print("Instruction: ");
Serial.print(instruction, BIN);
Serial.println();
delay(100);
pinMode(_SPIMOSI, OUTPUT);
digitalWrite(_SPICS, HIGH);
digitalWrite(_SPICS, LOW);
shiftOut(_SPIMOSI, _SPISCK, MSBFIRST, instruction >> 8);
shiftOut(_SPIMOSI, _SPISCK, MSBFIRST, instruction);
if(command & 0x1) {
digitalWrite(_SPIMOSI, LOW);
pinMode(_SPIMOSI, INPUT);
Expand Down Expand Up @@ -85,6 +82,10 @@ void AD9912::setFrequency(uint64_t fDDS) {
uint64_t FTW;
FTW = (uint64_t) (281474976710656 * (fDDS / (double) _fs));
AD9912::FTW_write(FTW);
digitalWrite(_IO_update, HIGH);
for(int i = 0; i < 512; i++)
delay(0.5);
digitalWrite(_IO_update, LOW);
}

void AD9912::updateClkFreq(uint64_t fs) {
Expand Down
5 changes: 2 additions & 3 deletions AD9912_sketch/AD9912_sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ void loop()
{
// put your main code here, to run repeatedly:
if(digitalRead(PUSH2) == LOW) {
ad9912.setFrequency(19440000);
//ad9912_frequency_sweep();
ad9912.setFrequency(190440000);
}
delay(100);
delay(5);
}

void flash_green() {
Expand Down

0 comments on commit f1a3f75

Please sign in to comment.