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 Display PIC16f877A with 74HC595

Status
Not open for further replies.

sureshkanna

Junior Member level 1
Joined
Mar 31, 2012
Messages
19
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,470
Hi dear friend


Already i posted my doubts ,but no one reply for that. please solve my problems.
i trying to display character in 8x8 dot matrix display using 74HC595. but i can't
here i added my code and proteus connection .please clear my doubts.




My code :



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
#define DS PORTD.F0
#define SHCP PORTD.F2
#define STCP PORTD.F1
/*------------------------------------------------------------*/
 
 
char a[9]={0xF8, 0x14, 0x12, 0x11, 0x11, 0x12, 0x14, 0xF8};
void main()
{
TRISB=0x00;
TRISD=0x00;
PORTB=0x00;
 
for(i=0;i<=7;i++)
{
PORTB=a[i];
 
if(i==0)
{
DS=1;
SHCP=0;
STCP=1;
delay_us(1);
SHCP=0;
STCP=0;
}
 
else if(a>0)
{
DS=0;
SHCP=0;
STCP=1;
delay_us(1);
SHCP=0;
STCP=0;
}
}
}



8x8  dot matrix.JPGView attachment 8x8 dot matrix.txt
 
Last edited by a moderator:

Code:
void display(void);
void clk(void);
void clear_display(void);
what about the definitions of these?

PORTB=0x00;...also remove this line and try
 

Code:
void display(void);
void clk(void);
void clear_display(void);
what about the definitions of these?

PORTB=0x00;...also remove this line and try




Thanks for replying sir ...

display, clock and clear display functions declaration are no need ,i forget to remove that ...

I removed PORTB=0... but it will not working ...


what i do?
 

Config setting means what sir?

we using 12MHz freq

16f877a Micro controller

if u mentioning in Programming wise means,

first we have to mention ,about port.

TRISB=0x00 // Port B is output

TRISB=0xff // Port B is input


it is right ?
 

config bits is the initial settings of PIC without that it wont work.which includes oscillator,WDT,Ports etc settings
Code:
TRISB = 0b00000000;//output
TRISB = 0b11111111;//B port as input.
using in binary form will makes you more easier to understand,

- - - Updated - - -

Read the datasheet also...https://ww1.microchip.com/downloads/en/devicedoc/39582b.pdf
 

ya i agree sir .... i won't use watchdog timer and like special features .. so i disabled like that feature ...I configured crystal frequency 12MHz and configured Input/output ports . here i am trying to drive some character on dot matrix display .. my doubt is my program is right or wrong ? ... then where i am misunderstanding the logic ? how to correct ? because my code not working.
 

What oscillator you are using internal?
 

i trying to display character in 8x8 dot matrix display using 74HC595

My code :
.....
// here starts the infinite loop
for(i=0;i<=7;i++)
{
PORTB=a;

if(i==0)
{
DS=1;
SHCP=0; // ??
STCP=1;
delay_us(1);
SHCP=0;
STCP=0;
}

else if(a>0) // what is this?
{
DS=0;
SHCP=0;
STCP=1;
delay_us(1);
SHCP=0;
STCP=0;
}
}


Hi sureshkanna;
There are three basic problems:

1st:
No SHCP pulses in your code. Try this:
SHCP=1; SHCP=0; // shift_in pulse
STCP=1;STCP=0; // store pulse

2nd:
I don't understand this line:
.... else if(a>0)
Instead a simpe 'else' is enough:
.... else

3rd:
Your code runs only once then stops.
To see something place the whole for cycle in an infinite loop (if the for cycle ends then go again)
 

Thanks dear friends ... Now i got output with ur guidelines ,so now i can display single character . but one small issue is, it is not scrolling . . . and also when i tried to scroll three character while it making some issue .here with i added my code and design ... give idea friend ...



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
/*******************************************************/
i written code for scroll three character in 8x8 dot matrix display  
/*******************************************************/
#define DS PORTD.F0
#define SHCP PORTD.F2
#define STCP PORTD.F1
/*------------------------------------------------------------*/
//Global Declaration
void clk(void);
void sendserial(unsigned char );
 
char a[25]={0xF8, 0x14, 0x12, 0x11, 0x11, 0x12, 0x14, 0xF8,
                 0x7E, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x42
                 0xF8, 0x14, 0x12, 0x11, 0x11, 0x12, 0x14, 0xF8};
unsigned int i ,j,l,k,temp;
void main()
{
  TRISB=0x00;
  TRISD=0x00;
 
  PORTD = 0x00;
  PORTB = 0x00;
 while(1)
   {
     for(i=0;i<=24;i++)
       {
       PORTB=~a[i];
       if(i==0)
        {
         DS=1;
        }
       else
        {
         DS=0;
        }
       SHCP=0;
       SHCP=1;
       delay_ms(4);
       STCP=1;
       STCP=0;
    }
   }
}
/**************************************************************/


Details and clarification :

1. Now i can display single character(i attached output image )
2. How to scroll(left to right or right to left) three character on display (i attached this hardware connection image).


give idea ... i am waiting for ur valuable reply .
 

Attachments

  • S -8x8- 3 display.JPG
    S -8x8- 3 display.JPG
    125.5 KB · Views: 187
  • S -8x8 single.JPG
    S -8x8 single.JPG
    81.8 KB · Views: 162
  • 8x8 code.txt
    890 bytes · Views: 97
Last edited by a moderator:

In second time when ur loop runnuing i value i==1 then it will go to else part see the coding so it can only display one chara

- - - Updated - - -

if that is your problem then the following code will show first two charectors
Code:
/************************************************/
#define DS PORTD.F0
#define SHCP PORTD.F2
#define STCP PORTD.F1
/*------------------------------------------------------------*/
//Global Declaration
void clk(void);
void sendserial(unsigned char );
char a[25]={0xF8, 0x14, 0x12, 0x11, 0x11, 0x12, 0x14, 0xF8,
            0x7E, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x42,
            0xF8, 0x14, 0x12, 0x11, 0x11, 0x12, 0x14, 0xF8};
unsigned int i ,j,l,k,temp;
void main()
{
  TRISB=0x00;
  TRISD=0x00;

  PORTD = 0x00;
  PORTB = 0x00;

 while(1)
   {
     for(i=0;i<=24;i++)
     {
       PORTB=~a[i];
       if(i==0)
        {
         DS=1;
        }
	elseif(i==1)
        {
         DS=1;
        }
       else
        {
         DS=0;
        }
       SHCP=0;
       SHCP=1;
       delay_us(400);
       STCP=1;
       STCP=0;
      }
   }
}
/***********************************************/
 

ya correct friend ...but it not scrolling :-( ....what i do to scroll one string???
 

You didn't entered any string in the program now i think you are given it as separate words string will be giving like this......
Code:
char a[25]="HELLO";

Then take a pointer which points to string then increment that....,but your display is 8*8 right ?
the program above will display one after another...

- - - Updated - - -

i don't know it can able to display a string
 
Last edited:

oh thanks dear friends .now i can shift string
 

i copied the code for character and string plz upload the corrected ones
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top