PDA

View Full Version : visualize clockout



JoelMurphy
- 5th December 2008, 16:40
hi-ho,

had this posted on the PicBasic side. it's lonely there.
i'd like to get the PIC to control a TLC5940 PWM controller for LEDs and whatnot. i have a grip on how the chip works, and how to format the data to its registers, but the 5940 requires a clock signal to time the PWM. [4096 cycles, a little handshake, 4096 more cycles...] i'm thinking 'hey, there's that TMR1 right there, why not, you know...' so i'm just ramping up on getting the CCP and TMR1 to talk to eachother. part of my solution for timing the PWM is to use the INTRC (clockout) configuration. i'm running a 16F88 and have gotten some good results with my test code, and i want to visualize the clockout on RA6. so, i went ahead and put an LED on it. it gives a little blink when the program starts up, but then nothing. what's going on? am i asking too much of the little OSC2? i even put my multimeter on it, thinking that i would at least see some +V... nuthin.
simple code below. sorry darryl, i'm not using your amazing thing.
as a side note, the software toggle of B.4 goes on and off like you read about. but the mulitplexed B.3 just sits there sorta 'on' even though i'm setting it low in the isr. i woulda thought that it would also give me some kind of pulsing output.


16F88, INTRC clockout, disable BOR due to 3V3


OSCCON = %0110110 '4MHz INTERNAL OSCILLATOR
ANSEL = %00000000 'MAKE PortA PINS ALL DIGITAL
TRISB = %00000000

LED VAR PortB.4
LED1 VAR PortB.3

T1CON = %00100001 'ENABLE TIMRE ONE, PRESCALE 1:1, USE INTERNAL CLK
INTCON = %11000000 'ENABLE GLOBAL INT, ENABLE PERIPHERAL INT,
PIE1 = %00000100 'ENABLE CCP1 INT
CCP1CON = %00001000 'COMPARE MODE, SET OUTPUT ON MATCH

CCPR1L = %00000000 'SET CCP REGISTER TO 4069
CCPR1H = %00010000

on interrupt goto ISR


Main:
PAUSE 1
GOTO Main

DISABLE
ISR:
TOGGLE LED
LOW led1
PIR1.2 = 0
TMR1H = 0
TMR1L = 0
RESUME
ENABLE

Bruce
- 5th December 2008, 22:06
Duplicate post: http://www.picbasic.co.uk/forum/showthread.php?t=10229

JoelMurphy
- 6th December 2008, 00:43
yes it's a duplicate.
but it seems that everyone is hanging out in the PBP room, and it's a PBP problem. it was miss-posted over there.
have had a chance to connect to the TLC5940 and it is not working. my suspicion is that the clockout function on RA6 is failing. does anyone have a clue as to why? i'll go in and bang my head against it tomorrow, but it seems to be a basic function of the chip to produce a reliable clockout.

baffled in brooklyn.

Bruce
- 6th December 2008, 01:09
Have you read the reply to your other post?