actor23
Member level 3
- Joined
- Dec 12, 2014
- Messages
- 56
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 8
- Activity points
- 515
void Interrupt() {
sendByte(*ptr2char++);
break;
case 1:
case 3:
case 5:
case 7:
case 9:
sendByte(0xFF);
break;
};
++select;
if((select == 0) || (select == 1) || (select == 3) || (select == 5) || (select == 7) || (select == 9)) {
CD4017_CLK = 1;
Delay_us(200);
CD4017_CLK = 0;
The interrupt occurs once every 2 ms and the delays used inside ISR and sendByte function take 200 us and 450 us and it is within the 2 ms time period.
The outputs of TPIC6b595 are open drain outputs and hence you will need 8 pull up resistors at the outputs of it.
ptr2char = display;
ptr2char = &display[0];
Code:ptr2char = &display[0];
It is not the cause of your problem, but why you use resistors to the common anode of the 7seg?
This will change the brightness depending on how much of the 7 segments are on.
Resistors should be used on the segment cathodes.
Have you measured the 4017 input lines and have the approximate 5V/0Vfor low/high values?
The cd4017 is capable of providing only 1,5mA on 5V supply, may not be enough depending on the NPN transistors selected.
Apparently you are not controlling it correctly. Is Q0 permanently high? Then you're either holding 4017 in reset or not clocking it.even outputs of tc4017 does not go high
CD4017_RST = 0;
#include "msp.h"
#include "main.h"
char capture[10] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90};
char select = 0;
unsigned int number = 12345;
char display[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
char *ptr2char = 0;
void sendByte(unsigned char byte);
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
// Configure GPIO
P5DIR |= BIT4 | BIT5; // CLK ve RST çıkışları
P4DIR |= BIT7 | BIT5 | BIT4; //SER_IN, RCK,SRCK
P5OUT &= ~BIT5;
P5OUT &= ~BIT4;
P4OUT &= ~BIT7;
P4OUT &= ~BIT5;
P4OUT &= ~BIT4;
RST_h;
_delay_cycles(50-1);
RST_l;
TA0CCTL0 = CCIE; // TACCR0 interrupt enabled
TA0CCR0 = 5000; // 5ms de bir interrupt
TA0CTL = TASSEL__SMCLK | MC__CONTINUOUS; // SMCLK, continuous mode
ptr2char = &display[0];
SCB_SCR |= SCB_SCR_SLEEPONEXIT; // Enable sleep on exit from ISR
__enable_interrupt();
NVIC_ISER0 = 1 << ((INT_TA0_0 - 16) & 31);
while (1)
{
display[0] = 0xF9;
display[1] = 0xA4;
display[2] = 0xB0;
display[3] = 0x99;
display[4] = 0x92;
}
}
// Timer A0 interrupt service routine
void TimerA0_0IsrHandler(void) {
switch(select) {
case 0:
case 2:
case 4:
case 6:
case 8:
sendByte(*ptr2char++);
break;
case 1:
case 3:
case 5:
case 7:
case 9:
sendByte(0xFF);
break;
};
++select;
if((select == 0) || (select == 1) || (select == 3) || (select == 5) || (select == 7) || (select == 9)) {
CLK_h;
_delay_cycles(200-1);
CLK_l;
}
if(select == 10) {
RST_h;
_delay_cycles(200-1);
RST_l;
select = 0;
ptr2char = &display[0];
}
TA0CCTL0 &= ~CCIFG;
}
void sendByte(unsigned char byte) {
char i = 0, mask = 0x80;
for(i = 0; i < 8; i++) {
if((byte & mask)==1){
SER_IN_h;
}
else if ((byte & mask)==0){
SER_IN_l;
}
SRCK_h;
_delay_cycles(50-1);
SRCK_l;
mask >>= 1;
}
RCK_h;
_delay_cycles(50-1);
RCK_l;
}
What's all this stuff about Ohm's Law , duty cycle and loss of efficacy for small duty cycles with high Ipk/Iavg?
Whenever you MUX LEDs you are limited on the duty cycle because the Absolute Max mA/ Rated mA is often only 3. Therefore increase the duty cycle from 5 to 10 makes the average current much lower than rated and thus much dimmer. or limited to 60mA /10 = 6mA average or 6mA/20mA=30% of rated intensity.
Bad idea.
A typical 10mm 7seg LED is rated for 20mA continuous and 60mA MAX
So using a 5 Digit MUX means you can only drive the LED at 12mA average at 20% duty cycle.
Using 500Hz fram rate will not produce any flicker and 2.5kHz digit clock increment rate should not produce much blurring.
However using a Common Anode series resistor is a bad idea since the voltage drop and thus intensity will reduce according tot he number of segments active. So using 60mA max at 20% d.f. * 7 segments or 300mA per digit must be at a constant voltage. Since the 4017 has a low drive current with <10% drop of-0.51mA min and -1mA typ at 25'C with 4.6V out from Vcc=5V you need a current gain in the NPN anode drivers of 300mA/0.5mA or 600x. THis can only be obtained with a Darlington. Now it is smarter to use Common Cathode with ULN200x Darlingtons x 7.. oh well.
Next you need to use Ohm's Law on the voltage drop.
4017 =0.4V @0.5mA @ Vcc=5V at 25'C
Darlington e.g. MMBT6427 for 300mA Vbe=1.25V @ 25'C at Ie=60mA
7 seg Red Vf=2.3V @ 60mA
Segment driver = 5.5Ω * 60mA = 330mV
Segment R series =?
Thus assuming V+=5V total drop is 0.4V +1.25+2.3V+0.33=4.28V leaving 0.72V to draw 60mA per segment.
This means the Rseries is 0.72V/60mA= 12Ω ( not 330Ω)
A tolerance analysis on each variable will increase Rseries to a safe value so as not to exceed 60mA max per segment.
e.g. if +5V is 5% or 5.25V then R series is 16Ω
To prevent bleeding between digits. each digit driver must be turned off fast.Thus a dummy load of 10% can be tolerated or 30mA@ (5-0.4-1.25V=3.35V/30mA=111Ω or 120Ω across Anode to ground.
Cebo is roughly 10~20pF when driver is reverse biased , Cibo is 15pF.
Using a 1 segment being tuned off the load ESR is ~10Ω thus 20pF*10Ω=peanuts for the driver.
LED decay time is fast at 500Hz Display frame rate.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?