Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DOT MATRIX WITH PIC16F877A ,CD4017 and ULN2803

Status
Not open for further replies.

jean12

Advanced Member level 2
Joined
Aug 27, 2013
Messages
529
Helped
5
Reputation
12
Reaction score
6
Trophy points
18
Activity points
5,497
Hello there,from the blog on https://embedded-lab.com/blog/?p=2661I want to drive three dot matrix with 74LS164 as serial -parrallel registers I am not coming to figure out how I can process for scrolling some three letters,can you please help.

see example codes here below and the circuits
PHP:
http://embedded-lab.com/blog/?p=2661
The proposed codes from the same site are here
PHP:
/*
  Project: Scrolling message on LED dot matrix display
  MCU: PIC18F2550 @ 48.0 MHz (StartUSB for PIC board)
  Copyright @ Rajendra Bhatt
  May 16, 2011
*/

// Define LCD module connections.
/* sbit Serial_Data at LATC2_bit;
 sbit SH_Clk at LATC6_bit;
 sbit ST_Clk at LATC7_bit;
 sbit CD4017_Clk at LATA2_bit;
 sbit CD4017_RST at LATA1_bit;
  */
 sbit Serial_Data at RC2_bit;
 sbit SH_Clk at RC6_bit;
 sbit ST_Clk at RC7_bit;
 sbit CD4017_Clk at RA2_bit;
 sbit CD4017_RST at RA1_bit;

void send_data(unsigned int temp){
 unsigned int Mask = 0x0001, t, Flag;
  for (t=0; t<16; t++){
   Flag = temp & Mask;
   if(Flag==0) Serial_Data = 0;
   else Serial_Data = 1;
   SH_Clk = 1;
   SH_Clk = 0;
   Mask = Mask << 1;
  }
  // Apply clock on ST_Clk
  ST_Clk = 1;
  ST_Clk = 0;

}

/* CharData is a two dimensional constant array that holds the 8-bit column values of
   individual rows for ASCII characters that are to be displayed on a 8x8 matrix format.
*/
const unsigned short CharData[][8] ={
{0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000},
{0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000000, 0b00000100},
{0b00001010, 0b00001010, 0b00001010, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000},
{0b00000000, 0b00001010, 0b00011111, 0b00001010, 0b00011111, 0b00001010, 0b00011111, 0b00001010},
{0b00000111, 0b00001100, 0b00010100, 0b00001100, 0b00000110, 0b00000101, 0b00000110, 0b00011100},
{0b00011001, 0b00011010, 0b00000010, 0b00000100, 0b00000100, 0b00001000, 0b00001011, 0b00010011},
{0b00000110, 0b00001010, 0b00010010, 0b00010100, 0b00001001, 0b00010110, 0b00010110, 0b00001001},
{0b00000100, 0b00000100, 0b00000100, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000},
{0b00000010, 0b00000100, 0b00001000, 0b00001000, 0b00001000, 0b00001000, 0b00000100, 0b00000010},
{0b00001000, 0b00000100, 0b00000010, 0b00000010, 0b00000010, 0b00000010, 0b00000100, 0b00001000},
{0b00010101, 0b00001110, 0b00011111, 0b00001110, 0b00010101, 0b00000000, 0b00000000, 0b00000000},
{0b00000000, 0b00000000, 0b00000100, 0b00000100, 0b00011111, 0b00000100, 0b00000100, 0b00000000},
{0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000110, 0b00000100, 0b00001000},
{0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00001110, 0b00000000, 0b00000000, 0b00000000},
{0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000100},
{0b00000001, 0b00000010, 0b00000010, 0b00000100, 0b00000100, 0b00001000, 0b00001000, 0b00010000},
{0b00001110, 0b00010001, 0b00010011, 0b00010001, 0b00010101, 0b00010001, 0b00011001, 0b00001110},
{0b00000100, 0b00001100, 0b00010100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00011111},
{0b00001110, 0b00010001, 0b00010001, 0b00000010, 0b00000100, 0b00001000, 0b00010000, 0b00011111},
{0b00001110, 0b00010001, 0b00000001, 0b00001110, 0b00000001, 0b00000001, 0b00010001, 0b00001110},
{0b00010000, 0b00010000, 0b00010100, 0b00010100, 0b00011111, 0b00000100, 0b00000100, 0b00000100},
{0b00011111, 0b00010000, 0b00010000, 0b00011110, 0b00000001, 0b00000001, 0b00000001, 0b00011110},
{0b00000111, 0b00001000, 0b00010000, 0b00011110, 0b00010001, 0b00010001, 0b00010001, 0b00001110},
{0b00011111, 0b00000001, 0b00000001, 0b00000001, 0b00000010, 0b00000100, 0b00001000, 0b00010000},
{0b00001110, 0b00010001, 0b00010001, 0b00001110, 0b00010001, 0b00010001, 0b00010001, 0b00001110},
{0b00001110, 0b00010001, 0b00010001, 0b00001111, 0b00000001, 0b00000001, 0b00000001, 0b00000001},
{0b00000000, 0b00000100, 0b00000100, 0b00000000, 0b00000000, 0b00000100, 0b00000100, 0b00000000},
{0b00000000, 0b00000100, 0b00000100, 0b00000000, 0b00000000, 0b00000100, 0b00000100, 0b00001000},
{0b00000001, 0b00000010, 0b00000100, 0b00001000, 0b00001000, 0b00000100, 0b00000010, 0b00000001},
{0b00000000, 0b00000000, 0b00000000, 0b00011110, 0b00000000, 0b00011110, 0b00000000, 0b00000000},
{0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00000010, 0b00000100, 0b00001000, 0b00010000},
{0b00001110, 0b00010001, 0b00010001, 0b00000010, 0b00000100, 0b00000100, 0b00000000, 0b00000100},
{0b00001110, 0b00010001, 0b00010001, 0b00010101, 0b00010101, 0b00010001, 0b00010001, 0b00011110},
{0b00001110, 0b00010001, 0b00010001, 0b00010001, 0b00011111, 0b00010001, 0b00010001, 0b00010001},
{0b00011110, 0b00010001, 0b00010001, 0b00011110, 0b00010001, 0b00010001, 0b00010001, 0b00011110},
{0b00000111, 0b00001000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00001000, 0b00000111},
{0b00011100, 0b00010010, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010010, 0b00011100},
{0b00011111, 0b00010000, 0b00010000, 0b00011110, 0b00010000, 0b00010000, 0b00010000, 0b00011111},
{0b00011111, 0b00010000, 0b00010000, 0b00011110, 0b00010000, 0b00010000, 0b00010000, 0b00010000},
{0b00001110, 0b00010001, 0b00010000, 0b00010000, 0b00010111, 0b00010001, 0b00010001, 0b00001110},
{0b00010001, 0b00010001, 0b00010001, 0b00011111, 0b00010001, 0b00010001, 0b00010001, 0b00010001},
{0b00011111, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00011111},
{0b00011111, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00010100, 0b00001000},
{0b00010001, 0b00010010, 0b00010100, 0b00011000, 0b00010100, 0b00010010, 0b00010001, 0b00010001},
{0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00011111},
{0b00010001, 0b00011011, 0b00011111, 0b00010101, 0b00010001, 0b00010001, 0b00010001, 0b00010001},
{0b00010001, 0b00011001, 0b00011001, 0b00010101, 0b00010101, 0b00010011, 0b00010011, 0b00010001},
{0b00001110, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00001110},
{0b00011110, 0b00010001, 0b00010001, 0b00011110, 0b00010000, 0b00010000, 0b00010000, 0b00010000},
{0b00001110, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010101, 0b00010011, 0b00001111},
{0b00011110, 0b00010001, 0b00010001, 0b00011110, 0b00010100, 0b00010010, 0b00010001, 0b00010001},
{0b00001110, 0b00010001, 0b00010000, 0b00001000, 0b00000110, 0b00000001, 0b00010001, 0b00001110},
{0b00011111, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100},
{0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00001110},
{0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00001010, 0b00000100},
{0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010001, 0b00010101, 0b00010101, 0b00001010},
{0b00010001, 0b00010001, 0b00001010, 0b00000100, 0b00000100, 0b00001010, 0b00010001, 0b00010001},
{0b00010001, 0b00010001, 0b00001010, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100},
{0b00011111, 0b00000001, 0b00000010, 0b00000100, 0b00001000, 0b00010000, 0b00010000, 0b00011111},
{0b00001110, 0b00001000, 0b00001000, 0b00001000, 0b00001000, 0b00001000, 0b00001000, 0b00001110},
{0b00010000, 0b00001000, 0b00001000, 0b00000100, 0b00000100, 0b00000010, 0b00000010, 0b00000001},
{0b00001110, 0b00000010, 0b00000010, 0b00000010, 0b00000010, 0b00000010, 0b00000010, 0b00001110},
{0b00000100, 0b00001010, 0b00010001, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000},
{0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00011111},
{0b00001000, 0b00000100, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000},
{0b00000000, 0b00000000, 0b00000000, 0b00001110, 0b00010010, 0b00010010, 0b00010010, 0b00001111},
{0b00000000, 0b00010000, 0b00010000, 0b00010000, 0b00011100, 0b00010010, 0b00010010, 0b00011100},
{0b00000000, 0b00000000, 0b00000000, 0b00001110, 0b00010000, 0b00010000, 0b00010000, 0b00001110},
{0b00000000, 0b00000001, 0b00000001, 0b00000001, 0b00000111, 0b00001001, 0b00001001, 0b00000111},
{0b00000000, 0b00000000, 0b00000000, 0b00011100, 0b00010010, 0b00011110, 0b00010000, 0b00001110},
{0b00000000, 0b00000011, 0b00000100, 0b00000100, 0b00000110, 0b00000100, 0b00000100, 0b00000100},
{0b00000000, 0b00001110, 0b00001010, 0b00001010, 0b00001110, 0b00000010, 0b00000010, 0b00001100},
{0b00000000, 0b00010000, 0b00010000, 0b00010000, 0b00011100, 0b00010010, 0b00010010, 0b00010010},
{0b00000000, 0b00000000, 0b00000100, 0b00000000, 0b00000100, 0b00000100, 0b00000100, 0b00000100},
{0b00000000, 0b00000010, 0b00000000, 0b00000010, 0b00000010, 0b00000010, 0b00000010, 0b00001100},
{0b00000000, 0b00010000, 0b00010000, 0b00010100, 0b00011000, 0b00011000, 0b00010100, 0b00010000},
{0b00000000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00010000, 0b00001100},
{0b00000000, 0b00000000, 0b00000000, 0b00001010, 0b00010101, 0b00010001, 0b00010001, 0b00010001},
{0b00000000, 0b00000000, 0b00000000, 0b00010100, 0b00011010, 0b00010010, 0b00010010, 0b00010010},
{0b00000000, 0b00000000, 0b00000000, 0b00001100, 0b00010010, 0b00010010, 0b00010010, 0b00001100},
{0b00000000, 0b00011100, 0b00010010, 0b00010010, 0b00011100, 0b00010000, 0b00010000, 0b00010000},
{0b00000000, 0b00001110, 0b00010010, 0b00010010, 0b00001110, 0b00000010, 0b00000010, 0b00000001},
{0b00000000, 0b00000000, 0b00000000, 0b00001010, 0b00001100, 0b00001000, 0b00001000, 0b00001000},
{0b00000000, 0b00000000, 0b00001110, 0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00011110},
{0b00000000, 0b00010000, 0b00010000, 0b00011100, 0b00010000, 0b00010000, 0b00010000, 0b00001100},
{0b00000000, 0b00000000, 0b00000000, 0b00010010, 0b00010010, 0b00010010, 0b00010010, 0b00001100},
{0b00000000, 0b00000000, 0b00000000, 0b00010001, 0b00010001, 0b00010001, 0b00001010, 0b00000100},
{0b00000000, 0b00000000, 0b00000000, 0b00010001, 0b00010001, 0b00010001, 0b00010101, 0b00001010},
{0b00000000, 0b00000000, 0b00000000, 0b00010001, 0b00001010, 0b00000100, 0b00001010, 0b00010001},
{0b00000000, 0b00000000, 0b00010001, 0b00001010, 0b00000100, 0b00001000, 0b00001000, 0b00010000},
{0b00000000, 0b00000000, 0b00000000, 0b00011111, 0b00000010, 0b00000100, 0b00001000, 0b00011111},
{0b00000010, 0b00000100, 0b00000100, 0b00000100, 0b00001000, 0b00000100, 0b00000100, 0b00000010},
{0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100, 0b00000100},
{0b00001000, 0b00000100, 0b00000100, 0b00000100, 0b00000010, 0b00000100, 0b00000100, 0b00001000},
{0b00000000, 0b00000000, 0b00000000, 0b00001010, 0b00011110, 0b00010100, 0b00000000, 0b00000000}
};

unsigned int DisplayBuffer[]={0,0,0,0,0,0,0,0};
unsigned int speed;
short i, l, k, ShiftAmount, scroll, temp, shift_step=1, StringLength;
char message[]="SCROLLING MESSAGE ON LED DOT-MATRIX DISPLAY FROM WWW.EMBEDDED-LAB.COM ";
char index;
void main() {
 CMCON = 0x07;   // Disable comparators
 ADCON0 = 0x00; // Select ADC channel AN0
 ADCON1 = 0b00001110;  // RA0 as analog input
 TRISC = 0x00;
 TRISB = 0xFF;
 TRISA = 0x01;
 StringLength = strlen(message) ;
 do {
 for (k=0; k<StringLength; k++){
  for (scroll=0; scroll<(8/shift_step); scroll++) {
   for (ShiftAmount=0; ShiftAmount<8; ShiftAmount++){
    index = message[k];
    temp = CharData[index-32][ShiftAmount];
    DisplayBuffer[ShiftAmount] = (DisplayBuffer[ShiftAmount] << shift_step)| (temp >> ((8-shift_step)-scroll*shift_step));
   }

  speed = 10+ADC_Read(0)/10;
  for(l=0; l<speed;l++){

   for (i=0; i<8; i++) {

    send_data(DisplayBuffer[i]);
    CD4017_Clk = 1;
    CD4017_Clk = 0;
    Delay_ms(1);
   }  // i
  CD4017_Rst = 1;
  CD4017_Rst = 0;
  } // l
  } // scroll
 } // k

 } while(1);

} With those ones the circuits in use is 74HCT595

Thanks
 

Attachments

  • DOT SCH.zip
    32 KB · Views: 139

Hello,where can I change for adjusting the clock speed;I said I am using 74LS164 not 74HCT595 as you know the 74HCT595 uses two clocking signals while 74LS164 uses only one clocking signal;so I want you to help me arrange those clocking signals.


Please help.
Thanks,
 

Hi,
you coated cd4017 which is a decade counter from the beginning, and I will suggest 4017 chip with and a AND GATES for cascading. kindly follow the link I gave for introduction on this.
kindly make the circuit available!
 
  • Like
Reactions: javito

    javito

    Points: 2
    Helpful Answer Positive Rating
That link you give me uses 74HCT595 which I want to replace with 74LS164 because I can't find those 74HCT595 ;please help with the codes the circuit will be posted soon.

The code are in MikroC which I don't know very well;pleas help editing the codes so they can be used for the circuit in attachment.
On the second link I am not finding the codes.

Thanks!!
 

Attachments

  • MOVING MESSAGE.zip
    32.9 KB · Views: 152
Last edited:

Since you don't know MicroC, or is it c language, then which one did you know? I am only trying to guide you and if you dont have foundation on this stuff it will be difficult for me to put you through.
 

Since you don't know MicroC, or is it c language, then which one did you know? I am only trying to guide you and if you dont have foundation on this stuff it will be difficult for me to put you through.
Hello,I am a biginner in mikroc,but if possible please help me to modify the codes from the sites above which was using 74LS595,ULN2803 and CD4017;so me I want to replace only 74KLS595 which uses two clocking signals as I am a biginner with Mikroc I don't know where to start by for those signal ST_CLK and SH_CLk of 74LS595 to be replaced by one clock sinal of 74LS164.

Please help,thanks.
 

74LS164 doesn't have a storage register. DS of 74HC595 should be replaced by A and B of 74LS164. If CLEAR is made low then the outputs of 74LS164 is cleared. SH_CP of HC595 is replaced by CLOCK of LS164. There is no ST_CP in LS164. HC595 is a D-FF based device and has two stages of D-FF's, one for shift registers and one for storage registers. LS164 is RS FF based device.
 
SO can you please help me to edit the posted codes above ,accordingly to the circuit?

Thanks.
 

It`s because I am trying many alternative but if you run one with the driver and those 74LS164 you can let me know.

Thanks
 

Have you not been convince enough that this chip 74ls164 can not work in this your design. Also check your datasheet and you will notice that the possibility of two output staying high using this chip. However, if you can't get 74hc595; make use of 4017. it make it simpler.
note: if you can't conclude on the hardware, software cannot be corrected. Good luck.
 

Hello check on this link**broken link removed** you find that it can be used and also the Big man Zuisti has used in many projects;so it can work but if you think that 4017 can be used for data transfer in place of 74ls595 you can let me know.

Me the component I can't find on that is only 74HCT595 but others I can find them;so the problem remains the codes.

Please help.

Thanks!!
 

My first message display were built on 74hc164 (and not 74ls164), physically they are the same, but internally 74ls uses rs- flip flop while 74hct uses d-flip flop. or what do you think? I was discourage from using it because not all the chip I bought were working.
Using 4017 is easier to adopt using the same code, learn the clocking from http://www.talkingelectronics.com/projects/5x7Display/Display_01_ Index.html

Regarding the link you share, use their code on your mplab or ccs. what you need is to reconfigure the micro controller use.
 
Last edited:

Hi jean12;

As I promised I made and uploaded a project, just as you wished: it uses a PIC16F876A, three 8x8 LED matrices, a 4017 (instead of LS138) with ULN2803, and three HC164 (instead of HC595). There are also a Start-Stop switch (see the DSN).

Note this is a Proteus-only project, I hope it works also in the reality, try it. But do not forget to use the current-limiting resistors at column side. I recommend a 150 Ohm because the matrix is short (3*8=24 columns) and the ULN can sink even 500 mA. Assuming 500/24= appr 20mA/led, 0.5v drop on a HC164 output (20 mA source current), and 1.4v drop on the ULN (500 mA sink current) the resistor value can be calculated:
R = (5-0.5-1.4)v / 0.02 A = 155 Ohm (24 pcs).

The project was attached here:
https://www.edaboard.com/threads/11364/#post1276668

PS.
I'm not a big man (only 172 cm high) but an old man: I'm 69 ... ;-)
zuisti

@ahmed-agt;

I do not speak English (never learned the language), this can be the reason, though:
- your style is sometimes 'instructing', even hurtful I feel. You have to know everyone in the forum is happy to help.
For example I agree, a 4017 chain can be used in place of the HC595 chain, but only in case when the column-scanning method is used, to activate one (and only one) column at a time. That should have been to write, right? Since - seems - 'jean12' (and me too) prefers the row-scanning method. But now I suggest to omit the row-column scanning debate ...

Yours sincerely.
 

Attachments

  • MMD_876A_4017_164.jpg
    MMD_876A_4017_164.jpg
    48.2 KB · Views: 164
  • Like
Reactions: jean12

    jean12

    Points: 2
    Helpful Answer Positive Rating
Hello,I tried the helpful codes you uploaded but they are giving half of the response to my question,the digit0 which is supposed to start before other thing is not coming complete it remains flickering on the first DOT MATRIX so it other DOT MATRIX are not displaying.
Only the second is showing sometime the column flickering and stops.

>>What do you want to mean by COF?
>>The sentence I want to display is "YOU ARE ALL WELCOME HERE" as it appears in the codes below,can you help me to reduce the codes in use.
>>Why are you saying that I can compile step by step?Which codes may I have to consider and the ones I have to ignore??
>>Are the above connections indicated on post #711 good or not ? They are indicating the pins between DOT MATRIX and 74HCTL164 and DOT MATRIX and ULN2803.
>>The ULN2803 must be connected on the columns or on the rows?
>>Where may I change for not displaying Bold characters?

But when I touch on the Ground power supply cable, the DOT MATRIX display all characters.can you tell me what I can do for collecting this? I am using 12MHz
Please help.

Thanks.
 
Last edited:

If you add any other delays in the code then matrix code execution timing gets delayed and you get flickering. You need to put the display code in an interrupt routine.
 

No this has been solved, the flickering has been stopped, I added a 100nF on the PIC between pin 20 and pin19.

Thanks.
 
Last edited:

Hello Sir,Zuisti what I want is only changing the font of the matrix.
If possible also help me to adjust the codes for 12MHZ of Quartz.

Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top