Title: Req: Si5351 using PICBAIC Code Post by: charudatt on April 14, 2015, 04:25:14 16:25 Hello
Has anyone tried programming the Si5351 , multi frequency output generator, using PICBASIC code ? Any sudo logic to program it will also help. regards. Title: Re: Req: Si5351 using PICBAIC Code Post by: Droneman1982 on May 05, 2015, 11:20:33 11:20 It can be programmed from I2C issuing the commands via picbasic, which is exactly your problem?
Title: Re: Req: Si5351 using PICBAIC Code Post by: charudatt on June 11, 2015, 06:35:39 06:35 I want an example code for a start. How to setup the registers , etc.
Title: Re: Req: Si5351 using PICBAIC Code Post by: Droneman1982 on June 11, 2015, 09:39:10 09:39 I assume you are going to use the software PICBASIC pro I2C commands and that you are using >4MHz system clock
the commands are two I2CREAD DataPin,ClockPin,Control,{Address,}[Var{,Var...}] I2CWRITE DataPin,ClockPin,Control,{Address,}[Value{,Value...}] Where datapin is the pic pin you are using to parse the data (SDA) and clockpin is the clock pin (SCL) Control is the slaveaddress (first 7 MSB) + direction (R/W) (LSB 1=READ, 0=WRITE) bit 1 of the slaveaddress is defined by the PIN A0 of the Si5351 (don't leave it floating if it doesn't have a pull-up or pull down) Address is the position of the first byte do be written and [is the data] http://melabs.com/resources/pbpmanual/ I suggest to use SYMBOL to define the I2CCLOCK and I2CDATA pins Code: SYMBOL I2CDATA = < the port you connect to SDA > the slave address(es) for this device should be: Code: SYMBOL ADDRREAD = %11000001 'the A0 pin is pulled low Now you can setup and program the device by issuing those commands Code: I2CREAD I2CDATA,I2CCLOCK,ADDRREAD,{Address,}[Var{,Var...}] for example, in order to disable all the outputs of the device you should write to the register 3 Code: I2CWRITE I2CDATA,I2CCLOCK,ADDRWRITE,3,[%0000000] I would suggest, to have a clean code, easy to troubleshoot to use the SYMBOL statement to configure the registers you want to configure during the inizialization of the device for example Code: 'Addresses Putting here all the registers you are going to change Code: 'values then during initialization: Code: I2CWRITE I2CDATA,I2CCLOCK,ADDRWRITE,Si5351_REG_2,[Si5351_REG_2_VALUES] and so on! Be careful to not change reserved registers or you will risk damage to your device! Whenever the reserved bits are only a part of a readable and writeable register you should first read it, change the bits that interest you, and them write it back to the device. I don't know exactly how to configure and which registers to set but the datasheet contains the list of the registers and the function of individual bits http://www.adafruit.com/datasheets/Si5351.pdf have a nice day :) Title: Re: Req: Si5351 using PICBAIC Code Post by: charudatt on June 12, 2015, 06:42:39 06:42 Thank you DroneMan1982, I'll be using Proton Basic for the coding, but I got the flow, I will try it out and get back to all on this thread as I proceed.
for my experiments I would be using, the Si5351 clock generator breakout from Adafruit and a 28 pin Development board using 18F26K22 chip. I would also be using the SiLAB's Clock Builder App to generate the register values for a given frequency. |