jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Delays in interrupt routines are a no no. You'll want to advance the scan position one digit on each timer tick and don't linger around in the interrupt code.Is it ok if I place SSD code with delays inside interrupt routine?
Yes, but how much should be the timer interrupt value? 500 us?You'll want to advance the scan position one digit on each timer tick
Not really critical, I think. For faster scan rates, you probably want to modify the control sequence: disable the segments, switch the digit driver, enable the new digit code, to avoid crosstalk on undriven segments.Yes, but how much should be the timer interrupt value? 500 us?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 //Timer1 //Prescaler 1:2; TMR1 Preload = 30533; Actual Interrupt Time : 3.5 ms //Place/Copy this part in declaration section void InitTimer1(){ T1CON = 0x11; TMR1IF_bit = 0; TMR1H = 0x77; TMR1L = 0x45; TMR1IE_bit = 1; INTCON = 0xC0; } void Interrupt(){ if (TMR1IF_bit){ TMR1IF_bit = 0; scanval++; if(scanval == 7)scanval = 1; switch(scanval){ case 1: PORTB = 0x01; PORTD = CA[sec%10]; break; case 2: PORTB = 0x02; PORTD = CA[sec/10]; break; case 3: PORTB = 0x04; PORTD = CA[min1%10]; break; case 4: PORTB = 0x08; PORTD = CA[min1/10]; break; case 5: PORTB = 0x10; PORTD = CA[hr%10]; break; case 6: PORTB = 0x20; PORTD = CA[hr/10]; break; } } TMR1H = 0x77; TMR1L = 0x45; TMR1IE_bit = 1; }
Explain what? I guess you fixed the problem by blanking the segment outputs before switching the digit, as already suggested in post #6.I didn't understand. Explain clearly.