Skip to main content

CNT0 Countetd Value write via I2C

3 months ago

CNT0 Countetd Value write via I2C

Posted byHardy0 points 1 reply
0 upvotes

Are the counted value registers of CNT0 /2 /4 read only or can they be written by I2C byte write to the respective address?

Purpose: I2C variation of duty cycle in oneshot mode...

accepted answer!

3 months ago

olehs

Hi Hardy,

Thank you very much for your appeal!

Please don't mix upCounted Valuewith theCounter Data. If you want to change the duty cycle using the CNT/DLY block you have to change theCounter Data.Counter Datacan be read and written. For the CNT/DLY blocks there are the dedicated registers:0xA5 0xA6(CNT/DLY0),0xAA(CNT1/DLY1),0xAF(CNT2/DLY2),0xB3(CNT3/DLY3),0xB8(CNT4/DLY4),0xBC(CNT5/DLY5),0xC1(CNT6/DLY6),0xC6(CNT7/DLY7). By changing these registers you will be able to change the duty cycle in your design. You can also refer to the Cookbook section, where a similar approach has been used:

//www.xmece.com/greenpak-cookbook/led-control-i2c

//www.xmece.com/greenpak-cookbook/setting-constant-duty-cycle

Or you can find many interesting designs here:

//www.xmece.com/sites/default/files/the_greenpak_cookbook_4q2020pdf.pdf

TheCounted Valueis the additional option that is available for the three counters CNT0, CNT2, and CNT4, which allows reading the internal DFFs' state.

Please let me know if have more questions about the GPAK.

Best regards,

olehs