sahu
Advanced Member level 2
- Joined
- Oct 9, 2009
- Messages
- 516
- Helped
- 68
- Reputation
- 130
- Reaction score
- 62
- Trophy points
- 1,308
- Location
- Uttar pradesh (INDIA)
- Activity points
- 3,876
then leave this idea ?
Is this some sort of school project that you have to select then implement or is this just for the sake of learning how to do something you've never tried to do before?
He wants to do this. See attached Proteus Simulation. For people who don't have Proteus, I have attached Simulation Video.
I think he is making some product and wants to implement his company name scrolling on the 7 Segment Display used in his products.
Code is very easy. You have to use interrupts and pointers. Try to write a code first. Scrolling from left to right is not good because it will be difficult to read it.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 #define SSD_DATA_PORT PORTC #define SSD_CONTROL_PORT PORTE const unsigned char cc_mask_sf[] = {0x00, 0x00, 0x00, 0x6D, 0x77, 0x76, 0x3E, 0x00, 0x00}; const unsigned char *ptr2_cc_mask_sf; unsigned char select = 0; unsigned int delay_counter = 0; unsigned int raw_adc_value = 0, previous_raw_adc_value = 0, required_delay = 0; //Timer1 //Prescaler 1:1; TMR1 Preload = 63536; Actual Interrupt Time : 2 ms //Place/Copy this part in declaration section void InitTimer1() { T1CON = 0x01; TMR1IF_bit = 0; TMR1H = 0xF8; TMR1L = 0x30; TMR1IE_bit = 1; INTCON = 0xC0; } long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } void Interrupt(){ if(TMR1IF_bit) { //Enter your code here SSD_CONTROL_PORT = 0x00; switch(select) { case 0: SSD_DATA_PORT = *ptr2_cc_mask_sf; SSD_CONTROL_PORT = 0x01; break; case 1: SSD_DATA_PORT = *(ptr2_cc_mask_sf + 1); SSD_CONTROL_PORT = 0x02; break; case 2: SSD_DATA_PORT = *(ptr2_cc_mask_sf + 2); SSD_CONTROL_PORT = 0x04; break; }; if(++delay_counter == required_delay) { if(ptr2_cc_mask_sf++ == &cc_mask_sf[6]) { ptr2_cc_mask_sf = &cc_mask_sf[0]; } delay_counter = 0; } if(++select >= 3) { select = 0; } TMR1IF_bit = 0; TMR1H = 0xF8; TMR1L = 0x30; } } void main() { CMCON = 0x07; ADCON0 = 0x40; ADCON1 = 0xCE; TRISA = 0xFF; TRISB = 0xFF; TRISC = 0x00; TRISD = 0xFF; TRISE = 0x00; PORTA = 0x00; PORTB = 0x00; PORTC = 0x00; PORTD = 0x00; Delay_ms(200); ptr2_cc_mask_sf = &cc_mask_sf; InitTimer1(); while(1) { raw_adc_value = ADC_Read(0); if(previous_raw_adc_value != raw_adc_value) { required_delay = map(raw_adc_value, 0, 1024, 250, 501); previous_raw_adc_value = raw_adc_value; } } }
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?