English
Language : 

SI5338 Datasheet, PDF (28/170 Pages) Silicon Laboratories – I2C-PROGRAMMABLE ANY-FREQUENCY, ANY-OUTPUT QUAD CLOCK GENERATOR
Si5338
6. Si5338 Registers
This section describes the registers and their usage in
detail. These values are easily configured using
ClockBuilder Desktop (see "3.1.1. ClockBuilder™
Desktop Software" on page 16). See AN428 for a
working example using Silicon Labs' F301 MCU.
6.1. Register Write-Allowed Mask
The masks listed in Table 15 indicate which bits in each
register of the Si5338 can be modified and which bits
cannot. Therefore, these masks are write-allowed or
write-enabled bits. These masks must be used to
perform a read-modify-write on each register.
If a mask is 0x00, all bits in the associated register are
reserved and must remain unchanged. If the mask is
0xFF, all the bits in the register can be changed. All
other registers require a read-modify-write procedure to
write to the registers. ClockBuilder Desktop can be used
to create ANSI C code (Options  Save C code header
file) with the register contents and mask values. AN428
demonstrates the usage of this header file and the read-
modify-write procedure.
The following code demonstrates the application of the
above write allowed mask.
 Let addr be the address of the register to access.
 Let data be the data or value to write to the register
located at addr.
 Let mask be the write-allowed bits defined for the
corresponding register.
// ignore registers with masks of 0x00
if(mask != 0x00){
if(mask == 0xFF){
// do a regular I2C write to the register
// at addr with the desired data value
write_Si5338(addr, data);
} else {
// do a read-modify-write using I2C and
// bit-wise operations
// get the current value from the device at the
// register located at addr
curr_val = read_Si5338(addr);
// clear the bits that are allowed to be
// accessed in the current value of the register
clear_curr_val = curr_val AND (NOT mask);
// clear the bits in the desired data that
// are not allowed to be accessed
clear_new_val = data AND mask;
// combine the cleared values to get the new
// value to write to the desired register
combined = clear_curr_val OR clear_new_val;
write_Si5338(addr, combined);
}
}
28
Rev. 0.6