Hello everybody,
I wanna use a board from rfcandy,
with the chip LMX2322, this chip is a PLL and need two register to be programmed, R and N.
I'have generate the value for 868Mhz frequency test, with the software from the same author
R-reg N-reg 001151 010F40
Registers are 18bits, since Arduino can only send 8bits each time, i use shiftOut function,
how can i split register to send correct value ?
shiftout can send bits per bits or i need to create something like that ?
SHIFTOUT (dataPin, clockPin, MSBFIRST, 8bits);
SHIFTOUT (dataPin, clockPin, MSBFIRST, 8bits);
SHIFTOUT (dataPin, clockPin, MSBFIRST, 8bits);
/*
Xtal = 16,8Mhz
Freq = 868Mhz
R-Counter Ref frequency N-Counter Error R-reg N-reg
168 100000 Hz 8680 0 Hz 001151 010F40
*/
const char RegR = 0x01151;
const char RegN = 0x10F40;
int clockPin = 13; //Clk
int dataPin = 11; //Data
int latchPin = 10; //Enb
void setup()
{
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void loop()
{
digitalWrite(latchPin, LOW);
byte byte1 = (RegN >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, byte1);
shiftOut(dataPin, clockPin, MSBFIRST, RegN);
byte byte2 = (RegR >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, byte2);
shiftOut(dataPin, clockPin, MSBFIRST, RegR);
digitalWrite(latchPin, HIGH);
delay(500);
}
(I have use VCO testing software, and PIC from based design, and its work fine, so its not a hardware problem)
also, i have removed following lines, because it's stuck arduino, i have checked clck and data pin via scope
#include <SPI.h>
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0); // National Semiconductor use MICROWIRE => CPOL = 0 & CPHA = 0
SPI.setClockDivider(SPI_CLOCK_DIV4);
anybody can help me ?
regards