Цитата(VCO @ Mar 26 2013, 18:24)

Прочитайте вот этот документ:
140-00074-00_operating_guide.pdfОгромный пожалуйста...
Я читал этот документ и делал по указаниам несколько раз, но еще не получил.
вот мой HMC769_register файл.
CODE
REG 0 97370
REG 1 2
REG 2 1
REG 3 30 // Nint = 0x30 = 48d --> Fint = 48*fxtal/R = 48*48=2304 MHz --> Fvco=Fint*4+Ffrac*4 ~ 9300 (MHz)
REG 4 28F5C // Nfrac
REG 5 DEADBE
REG 6 1E // work in fraction mode 0x06[7:5] = 0;
REG 7 104845 // the same as hittite model
REG 8 36FFF
REG 9 3F7FFF
REG A 1
REG B 1E071
REG C 1F
REG D 0
REG E 0
REG F 1
REG 11 0
REG 12 3
REG 13 1259
REG 14 0
REG 15 0
REG 16 0
REG 17 0
REG 18 0
REG 19 0
REG 1A 0
REG 1B 0
REG 1C 0
REG 1D 0
REG 1E 0
REG 1F 0
REG 10 0
и это мой код, плз дайте мне нескол. советы.CODE
#include <mega32a.h>
#include <delay.h>
#include <i2c.h>
#include <stdio.h>
#include <math.h>
// Declare your global variables here
float fxtal = 48.000000; //MHz
unsigend int R = 1; //R is the reference path division ratio
// Define returned value from function
#define SUCCESS 1
#define ERROR -1
unsigned long int DefaltArray[32] =
{
0x97370, //REG 0
0x2, // REG 1
0x1, // REG 2
0x30, // REG 3 Nint = 0x30 = 48d --> Fint = 48*fxtal/R = 48*48=2304 MHz --> Fvco=Fint*4+Ffrac*4 ~ 9300 (MHz)
0x28F5C, // REG 4 Nfrac
0xDEADBE, //REG 5
0x1E, // REG 6 work in fraction mode 0x06[7:5] = 0;
0x104845, // REG 7 the same as hittite model
0x36FFF, // REG 8
0x3F7FFF, // REG 9
0x1, // REG A
0x1E071, // REG B
0x1F, // REG C
0x0, // REG D
0x0, // REG E
0x1, // REG F
0x0, // REG 11
0x3, // REG 12
0x1259, // REG 13
0x0, // REG 14
0x0, // REG 15
0x0, // REG 16
0x0, //REG 17
0x0, //REG 18
0x0, // REG 19
0x0, // REG 1A
0x0, // REG 1B
0x0, // REG 1C
0x0, // REG 1D
0x0, // REG 1E
0x0, // REG 1F
0x0 // REG 10
};
#define AVR_SDO PORTA.0
#define AVR_SDI PORTA.1
#define AVR_SCK PORTA.2
#define AVR_SEN PORTA.3
//-------------------------------HMC769 по рис 16 "140-00074-00_operating_guide"-------------------------
void spi_write(unsigned char address, unsigned long int data)
{
//
int i = 0;
//
AVR_SEN = 0;
AVR_SCK = 0;
//
AVR_SEN = 1;
delay_us(5);
//bit WR = 0
AVR_SDI = 0;
delay_us(1);
//
AVR_SCK = 1;
//
for(i = 0; i < 6; i++)
{
AVR_SCK = 0;
AVR_SDI = ((address >> (5 - i)) & 1);
delay_us(1);
AVR_SCK = 1;
}
//
for(i = 0; i < 24; i++)
{
AVR_SCK = 0;
AVR_SDI = ((data >> (23 - i)) & 1);
delay_us(1);
AVR_SCK = 1;
}
AVR_SCK = 0;
AVR_SDI = 0;
delay_us(5);
//
AVR_SCK = 1;
AVR_SCK = 0;
delay_us(5);
//SEN = 0
AVR_SEN = 0;
}
void initRegister()
{
int i;
for(i = 0; i < 32; i++)
{
spi_write(i, DefaltArray[i]);
}
}
void setFrequence(float fvco) // MHz
{
float fint, ffrac;
unsigned int Nint;
unsigned long int Nfrac;
//Count Nint
Nint = (unsigend int) floor(fvco*R/fxtal/2);
fint = 2*Nint*fxtal/R;
//Count Nfrac
ffrac = fvco - fint;
Nfrac = (unsigned long int) floor(ffrac*R*pow(2, 23)/fxtal);
//write data
spi_write(0x0F, Nint);
spi_write(0x10, Nfrac);
}
void main(void)
{
// Declare your local variables here
float fvco = 9500.000000;//9.5 GHz
// Input/Output Ports initialization
// Port A initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTA=0xFF;
DDRA=0xFF;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=Out Func2=Out Func1=Out Func0=Out
// State7=T State6=T State5=T State4=T State3=0 State2=0 State1=0 State0=0
PORTB=0xFF;
DDRB=0x0F;
// Port C initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTC=0xFF;
DDRC=0xFF;
// Port D initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTD=0xFF;
DDRD=0xFF;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=0xFF
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=0xFFFF
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=0xFF
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// USART disabled
UCSRB=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// ADC initialization
// ADC disabled
ADCSRA=0x00;
// SPI initialization
// SPI disabled
SPCR=0x00;
// TWI initialization
// TWI disabled
TWCR=0x00;
AVR_SEN = 0;
AVR_SCK = 0;
AVR_SDI = 0;
//
initRegister();
//Working frequency
fvco = 9500.000000;//9.5 GHz
//PLL-VCO
setFrequence(fvco);
while (1)
{
}
}
большой спасибо.