Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pic24hj502, tlc5940, SCLK

Status
Not open for further replies.

mishkinis

Newbie level 4
Joined
Nov 2, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,383
Hi, I am making an 8x8 RGB LED matrix and I am using PIC24HJ502 microcontroller & TLC5940 LED driver. I consider myself weak at programming so I need a bit of your help. For starters I want to generate continuous pulse of ~76 KHz from my micro controller to a SCLK (data shift clock) of TLC5940. I know that everything can be done by SPI module in PIC24 but If I'm not able produce even a simple pulse I will not be able to understand that yet. I have set the configurations in the following way:

#include<p24hj128gp502.h>

int dc;

void main(void)

{
AD1PCFGL = 0xFFFF; // All ADC pins are set to digital (IO) fucntion
OSCTUN=0b11111; // Oscillator tunning register ~7.345 Mhz

_PLLPRE = 0 ;// then N1 = 2. This yields a
_PLLDIV = 20; // then M = 32. This yields a
_PLLPOST = 0; // then N2 = 2. This provides

T1CONbits.TCKPS = 0b01; //Timer1 prescale
_TRISB0=0;
dc=25;

_RP0R=0b10010; // This assigns OC1 to RP0

OC1CONbits.OCM=0b101; // Continious PWM mode

OC1RS=256/100*dc; // Dutycycle
OC1R=0;//

PR2=255;
PR1=20000;

T2CONbits.TON=1;
T1CONbits.TON=1;
_T1IE=1;
_T1IF=0;

}



This is mainly fragments I found in the datasheet and reference manual. The frequencies I set here are not correct but I will adjust it when I know what I'm doing.

Any advices?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top