Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

TLC5940 operation

Status
Not open for further replies.

tubos

New Member
I've been reading through the datasheet but I still have a few questions:

What i would like to do is:

- Create a continuous GSCLOCK signal using a hardware PWM pin at 500khz
- create a continuous BLANK signal using a hardware PWM pin at 500k/4096 khz

does this work ?

While those 2 signals run , can I load in new GS data serially at the same time or
do i need to stop the hw pwm's & load new data & latch it & then run the hw pwm
again?

I hope this is clear as a question :)
 
Yes you can run the GSCLOCK signal using hardware PWM. I've never tried it but you should be able to use a PWM for the BLANK signal, can't think of a reason why not.

Yes you can load new serial data in anytime you like. You don't have to stop the GSCLOCK or anything to load in new data. Ideally, for glitchless operation (you probably wouldn't notice it anyway) you would latch the new data in at the end of a greyscale cycle while the blank pin is active but that would be hard to do using PWM for BLANK and GSCLOCK.
 
I used (shared more like) the grayscale clock (PWM) as the T1CK input for TMR1. That way you can play around with the grayscale PWM, and the blank period follows along.

Used a TMR1 overflow interrupt routine to Blank, by pre-loading the TMR1 register for 4096 cycles. I recollect having trouble latching data in the interrupt routine for some reason, although it should work.
 
I used (shared more like) the grayscale clock (PWM) as the T1CK input for TMR1. That way you can play around with the grayscale PWM, and the blank period follows along.

Used a TMR1 overflow interrupt routine to Blank, by pre-loading the TMR1 register for 4096 cycles. I recollect having trouble latching data in the interrupt routine for some reason, although it should work.

I do the same. Count your PWM greyscale pulses with a timer input and when you have reached 4096 cycles you then:

- Activate blank signal. This resets the greyscale counter.
- Latch your last transferred data in.
- Deactivate blank signal.

Anywhere in between (in your main loop) you can send the serial data.
 
1) You physically connect the output of your hardware pwm signal
to the input of a T0CK or T1CK pin setup as counter
and generate an interrupt after 4096 pulses?
Do you use 4096 compare or overflow interrupt?

2) Doesnt that pose problems when your latch comes when you're only halfway sending
new data in your main loop ? Or do you check for that?
 
1) You physically connect the output of your hardware pwm signal
to the input of a T0CK or T1CK pin setup as counter
and generate an interrupt after 4096 pulses?
Do you use 4096 compare or overflow interrupt?

2) Doesnt that pose problems when your latch comes when you're only halfway sending
new data in your main loop ? Or do you check for that?
1) Yes physically connect the CCP1 output to the T1CK pin. You could use the CCP2 special event trigger as an interrupt, so that way you wouldn't have to pre-load TMR1.

2) Set a flag (new_data = true) in main when done sending new data, then check that flag and clear it (new_data = false) in the interrupt routine.

If you happen to be multiplexing the display, doing multiples of a timing loop at a time, it gets kinda messy. This is where a logic analyzer could be very helpful?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top