Control a PCA9633 with I2C

spectrum

New Member
Does anyone has an example code for controlling a PCA9633 PWM controller ?

I can not do it.

Thanks in advance !
 

hippy

Technical Support
Staff member
I am not familiar with that chip and couldn't find anything on the forum but there's a datasheet here -

https://www.nxp.com/docs/en/data-sheet/PCA9633.pdf

It might be worth letting us know which size chip you are using so the Device Address can be figured out, and a link to the product if you bought it on a break-out board could help.

It doesn't look like it should be too difficult to get working so it may also be worth posting what code you have so far and showing your circuit or describing how you have connected the LED's.

It looks to me to be a case of initialising the two configuration bytes, enable the LED's for dimming by setting LEDOUT (%10101010), then set the four PWM levels for the LED brightnesses required. It doesn't look like GRPPWM, GRPFREQ or the rest need to be set.
 

spectrum

New Member
Hi Hippy,

this is the datasheet: http://www.produktinfo.conrad.com/datenblaetter/1100000-1199999/001116572-da-01-en-IC_LED_TREIB_PCA9633DP2_118_TSSOP_10_NXP.pdf

I've got the 10 pin version.

I connected the I2C bus to a 20X2. 2 pull up resistors of 10K each. A0 and A1 are connected to ground.

The first goal is to get out a PWM signal at port LED0. Port LED0 is connected to my oscilloscope.

This is the code:

hi2csetup i2cmaster, %11000000, i2cfast_8, i2cbyte ; %11000000 is the slave address of the PCA9633
hi2cout 2, (150) ; register 2 for port LED0 and a value of 150

It seems not as simple as controlling an MAX521 (I2C to analog) wich I controlled in the past.

Thanks in advance for any help.

Kind regards.
 

hippy

Technical Support
Staff member
This would be my first atte,pt -
Code:
#Picaxe 20X2
#No_Data

Symbol MODE1   = $00
Symbol MODE2   = $01
Symbol LED0    = $02
Symbol LED1    = $03
Symbol LED2    = $04
Symbol LED3    = $05
Symbol GRPPWM  = $06
Symbol GRPFREQ = $07
Symbol LEDOUT  = $08

Init:

  HI2cSetup I2CMASTER, %11000000, I2CSLOW, I2CBYTE

  HI2cOut MODE1,  ( %10000000 )
  HI2cOut MODE2,  ( %00000100 )
  HI2cOut LEDOUT, ( %10101010 )

MainLoop:

  Do
    For b0 = 0 To 254
      HI2cOut LED0, ( b0 )
    Next
    For b0 = 255 To 1 Step -1
      HI2cOut LED0, ( b0 )
    Next
  Loop
 

spectrum

New Member
Hi Hippy,

thanks very much for the support. It works fine ! I didn't know that the PCA9633 needed to be initiated...

Thanks a lot :)
 

hippy

Technical Support
Staff member
Excellent news. Glad it worked and thanks for letting us know.

With 'single function' devices they are often pre-configured and power-up 'ready to use' so it's just a matter of setting output data or reading input data. For devices which are more 'multi-function', can be configured in different ways, there is usually some configuration to be done.

In this case there's not much configuration to do; taking it out of standby so it does something, setting the LED drivers to give an output. The hard part is usually digging through a datasheet to find what needs to be set and how and what is not relevant or initialised on power-up to how it should be.
 
Top