CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

74164 for 8X8 Matrix LED -Help

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Cmed



Joined: 01 Nov 2011
Posts: 4

View user's profile Send private message

74164 for 8X8 Matrix LED -Help
PostPosted: Tue Nov 01, 2011 6:31 pm     Reply with quote

Hi everyone,
I tried to write a letter on 8X8 LED MATRIX but the display isn't stable,
when I run it under STEP BY STEP, it works but when I run it normally it doesn't!!!!!
Please i need your help on that problem:
Code:

//C Med Matrix LED-----------------------------------------------------
#include <16F876A.h>
#device adc=8
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES XT                       //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#use delay(clock=4000000)

#define   DATA   pin_a3
#define   CLOK   pin_a2
int i;
int Shdata[8]={0xFF,0xFF,0x70,0x38,0x70,0xFF,0xFF,0x00}; // M Letter

void HCLK164(int a)
{
switch (a)
  {
  case 0: output_high(DATA);break;
  case 1: output_low(DATA);break;
  case 2: output_low(DATA);break;
  case 3: output_low(DATA);break;
  case 4: output_low(DATA);break;
  case 5: output_low(DATA);break;
  case 6: output_low(DATA);break;
  case 7: output_low(DATA);break;
  }
  output_high(CLOK);
  delay_us(10);
  output_low(CLOK);
}

//Main Program------------------------------------------------------------------
void main()
{
while(1)
 for(i=0;i<8;i++)
  {
   HCLK164(i);
   output_B(~Shdata[i]);
   // HCLK164(i); when i put it here and i delete the above one it works half!!!
   delay_ms(6);
  }
}

I give you too the picture of simulation if you want to try it.


**THANK YOU SO MUCH**
Cmed



Joined: 01 Nov 2011
Posts: 4

View user's profile Send private message

No one find a solution!!!!!
PostPosted: Wed Nov 02, 2011 6:44 am     Reply with quote

I need help in this as soon as possible please
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Matrix Display
PostPosted: Wed Nov 02, 2011 9:38 am     Reply with quote

You don't describe the nature of the instability.

I suspect you have fallen into an old trap.

Without input from you, I guess you are suffering from leakage.

The usual problem with multiplexed displays is data from one row (or column) leaking into the next. (Depends on which way round your matrix is connected)

What you are attempting to do is strobe each column in turn with the output from your 74164 as you sequence through the column data.

Unfortunately there is a brief period when LEDs in the wrong column are lit as you advance the strobe. The effect on the display is a faint glow from some LEDs which should not be lit at all.

What you need to do is:-

1 Turn all the LEDs off.
2 Advance the strobe.
3 Turn the LEDs on with the next set of data.
4 Wait, then repeat from 1.

Mike

PS. I would not use the software timer to multiplex the display. It's usually better to use one of the built in timers and interrupt control. That way your display takes care of itself as a background task with minimal flickering
Cmed



Joined: 01 Nov 2011
Posts: 4

View user's profile Send private message

Re: Matrix Display
PostPosted: Wed Nov 02, 2011 12:50 pm     Reply with quote

Mike Walne wrote:

What you need to do is:-

1 Turn all the LEDs off.
2 Advance the strobe.
3 Turn the LEDs on with the next set of data.
4 Wait, then repeat from 1.

Mike

PS. I would not use the software timer to multiplex the display. It's usually better to use one of the built in timers and interrupt control. That way your display takes care of itself as a background task with minimal flickering

Thank you MIKE,
It's kind from you but i think that i did these steps until you asked me to do so...
So please can you send me a small code just to write a letter on my MATRIX
I'm a beginner in CCS and the time is running out of me.

Thank you once more
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Instability
PostPosted: Thu Nov 03, 2011 5:13 pm     Reply with quote

What is the nature of the instability on your display?

In other words, describe what are you seeing.

At this stage you are leaving me to guess at the what your problem is.

You are trying to implement a multiplexed display.

The PIC you're using is more than capable of giving satisfactory results.

I see that you are strobing at ~6ms intervals. This means you are updating your display once every ~48ms (8*6ms). 48ms equates to 20Hz which is far too slow. At that kind of frequency you will be able to see a ripple effect through the matrix. As I said before use one of the built in timers and an interrupt.

I also don't see any current limiting resistors around your matrix. Are they built into the LED matrix? Or are you relying on the limited current capability of your silicon chips?

Like the other contributers to this forum I urge you write your own code. That way you'll learn a lot more. I'll give advice and hints but I don't have time to produce debugged code for you.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group