[SOLVED] Proteus problem on displaying letters for Dot Matrix Display

Status
Not open for further replies.

lloydi12345

Member level 4
Joined
Aug 31, 2010
Messages
77
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Activity points
1,953
I'm having hard time on simulating the letters properly on Proteus 7.7 SP2. Some LEDs are missed. I don't know if it's on the version of my software or just the codes or hardware. Here's a screenshot of my problem on displaying letter B:



here's the code:

Code:
const unsigned short letters[16] = {

0xFF, 0x01, 0xEE, 0xEE, 0xEE, 0x01, 0xFF, 0xFF,   //A
0xFF, 0x00, 0x76, 0x76, 0x76, 0x89, 0xFF, 0xFF   //B

};


unsigned short column, num, repeat, count;

void main() {
    LATA = 0;
    LATB = 0;
    LATC = 0;
    TRISA = 0;
    TRISD = 0;
    TRISC = 0;
    CMCON = 0x07;
    column = 1;
    

while(1) {
    for (num=0;num<2;num++){
      for (repeat=0; repeat<20; repeat++){
           column = 1;
       for (count = num*8;count < (num*8+8);count++){
           portd = letters[count];
           portc = column;
           delay_ms(10);
           column = column<<1;
           }
      }
    }
}
}

Thanks in advance for your help.
 

What C compiler are you using? Can you upload your Proteus Simulation file?

Are you using a PIC18F or PIC16F in your design? What is the exact model of the PIC?

It appears you may have forgotten to disable other peripherals which share some of the port pins.


BigDog
 

Sorry bigdogguru I forgot the attachment. I don't know why I can't upload files on edaboard anyway here's the link.

**broken link removed**
or
**broken link removed**

I'm using Mikroc Pro for PIC and PIC18f4620. I don't know if it's about the simulation or animation settings on proteus that needs to be adjusted.
Thanks.
 

Here is the fixed code:
Code:
const unsigned short letters[16] = {

0xFF, 0x01, 0xEE, 0xEE, 0xEE, 0x01, 0xFF, 0xFF,   //A
0xFF, 0x00, 0x76, 0x76, 0x76, 0x89, 0xFF, 0xFF   //B

};


unsigned short column, num, repeat, count;

void main() {
    LATA = 0;
    LATB = 0;
    LATC = 0;
    TRISA = 0;
    TRISD = 0;
    TRISC = 0;
    CMCON = 0x07;
    column = 1;
    

while(1) {
    for (num=0;num<2;num++){
      for (repeat=0; repeat<20; repeat++){
           column = 1;
           for (count = num*8;count < (num*8+8);count++){
               portc = 0;  //  --------------------------------------------------> Add this line here
               portd = letters[count];
               portc = column;
               delay_ms(10);
               column = column<<1;
           }


      }
    }
}
}

You need to clear the current column before moving to the next one, otherwise you don't get proper display.

Hope this helps.
Tahmid.
 
WOW thanks.. That one line code did the trick. Actually I just integrated my codes from this site: Lab 12: Basics of LED dot matrix display :Embedded Lab and the programmer might have missed the line you have recommended me. I guess I expected a lot from the site and didn't checked everything line by line. Thanks for the fix Tahmid.. Thank you Tahmid and bigdogguru

Cheers,

lloyd
 
Last edited:
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…