Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 25, 2024, 02:46:29 14:46


Login with username, password and session length


Pages: [1]
Print
Author Topic: Req: Si5351 using PICBAIC Code  (Read 5479 times)
0 Members and 3 Guests are viewing this topic.
charudatt
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 53
-Receive: 70


« 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.
Logged
Droneman1982
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 3
-Receive: 12


« Reply #1 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?
Logged
charudatt
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 53
-Receive: 70


« Reply #2 on: June 11, 2015, 06:35:39 06:35 »

I want an example code for a start. How to setup the registers , etc.
Logged
Droneman1982
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 3
-Receive: 12


« Reply #3 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 >
SYMBOL I2CCLOCK =  < the port you connect to SCL >

the slave address(es) for this device should be:

Code:
SYMBOL ADDRREAD    = %11000001          'the A0 pin is pulled low
SYMBOL ADDRWRITE  = %11000000          '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...}]

I2CWRITE I2CDATA,I2CCLOCK,ADDRWRITE,{Address,}[Value{,Value...}]


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
SYMBOL Si5351_REG_2 = 2   ' Interrupt Status Mask
SYMBOL Si5351_REG_3 = 3   'output enable
.....
SYMBOL Si5351_REG_10 = 15  'whatever it does....


Putting here all the registers you are going to change

Code:
'values
SYMBOL Si5351_REG_2_VALUES  =  %00000000  ' SYS_INIT_MASK = 0 | LOL_B_MASK = 0 | LOL_A_MASK  = 0 | LOS_MASK = 0
SYMBOL Si5351_REG_3_VALUES  =  %00000000   ' enabling all outputs             
.....
SYMBOL Si5351_REG_10 = 15  'whatever it does....



then during initialization:

Code:
I2CWRITE I2CDATA,I2CCLOCK,ADDRWRITE,Si5351_REG_2,[Si5351_REG_2_VALUES]
I2CWRITE I2CDATA,I2CCLOCK,ADDRWRITE,Si5351_REG_3,[Si5351_REG_3_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  Smiley
Logged
charudatt
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 53
-Receive: 70


« Reply #4 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.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC