CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PCA9685
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 04, 2019 9:52 pm     Reply with quote

I changed your program to fit my board. I didn't want to wire in all your
switches, so I added delays and printfs instead. The program works fine
on my board.

When the program runs, it displays the following text in TeraTerm, and
the LED tracks what the comments say. It does those things.
Code:
Start
Test 1 - Low brightness
Test 2 - High brightness
Test 3 - All off
Test 1 - Low brightness
Test 2 - High brightness
Test 3 - All off
.
.
.

I suggest that you try my program. If it still fails, I think you may have a
hardware problem. Where did you buy your PCA9685 board ? Post a link
to the website. Maybe the chip is counterfeit. Or just buy the board that I
bought, in the Amazon link that I gave in an earlier post.

Test program:
Code:

#include <16F1847.h>
#fuses NOWDT
#use delay(internal=4M)
#use rs232(baud=9600, UART1, ERRORS)

#include <pca9685.h>

//=================================
void main()
{
delay_ms(100);

printf("Start \n\r");

pca9685_init(PCA9685);
pca9685_brightness(LEDDRV1,100,15);
pca9685_brightness(LEDDRV1,100,0);
delay_ms(1000); 

while(true)
     {
      printf("Test 1 - Low brightness \n\r");   
      pca9685_brightness(LEDDRV1,25,15);
      pca9685_brightness(LEDDRV1,25,0);
      delay_ms(1000);

      printf("Test 2 - High brightness \n\r");   
      pca9685_brightness(LEDDRV1,50,15);
      pca9685_brightness(LEDDRV1,50,0);
      delay_ms(1000);

      printf("Test 3 - All off \n\r");   
      PCA9685AllLedOff(LEDDRV1);
      delay_ms(1000);
     }

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19494

View user's profile Send private message

PostPosted: Mon Nov 04, 2019 11:03 pm     Reply with quote

Sterngleiter wrote:
ok, I could try with 4k7. I ask my question better with PCA9685AllLedOff (LEDDRV1); I turn off all LEDs. how do I have to write all-led-on registers so that they glow with 50%, for example, or do I have to control them individually? But there is a register with all-led-on address FA and FB


What are your resistors?.
4K7 is the _largest_ resistor that has a hope of running at 400KHz (FAST).
If your resistors are bigger than this, then 'no wonder' it doesn't work.
4K7 supports a maximum bus capacitance of just 60pF at 400K.
If you have (for example) 10KR, then the maximum bus capacitance
will be below that of simply the chips pins, let alone if you have any wire
connecting the devices....
For a 200pF bus a resistance of 1K8 is needed.
Try the simple thing of switching your bus to 100K (slow). I suspect you
are then going to find it works.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 3:07 am     Reply with quote

I thank you all
Ttelmah



Joined: 11 Mar 2010
Posts: 19494

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 8:01 am     Reply with quote

Does that mean that with lower resistors or a slower rate, it is working?.
If so, post and say, so that future people can know what the problem was.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group