| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Pikasa 
 
 
 Joined: 22 Nov 2015
 Posts: 1
 
 
 
			    
 
 | 
			
				| DOT matrix display using 74hc595 & cd4017 in pic16f877a |  
				|  Posted: Sun Nov 22, 2015 4:36 am |   |  
				| 
 |  
				| dear all, 
 I am trying to interface 8X8 dot matrix display in PIC CCS. i am getting some problem in this. Can anyone help, i am trying for 2 days.
 
 my code is below
 
 
 long int chk[]={0b00011111, 0b00010000, 0b00010000, 0b00011110, 0b00000001, 0b00000001, 0b00000001, 0b00011110}
 void main()
 {
 
 set_tris_c(0x00);
 set_tris_d(0x00);
 while(TRUE)
 {
 
 count();
 
 
 }
 }
 
 
 void count()
 {
 for(i=0;i<8;i++)
 {
 
 shift(chk[i]);
 CD_CLK = 1;
 delay_us(1500);
 CD_CLK = 0;
 delay_us(1500);
 }
 CD_RST = 1;
 delay_us(500);
 CD_RST = 0;
 }
 
 void shift(unsigned long int temp)
 {
 unsigned long int mask = 0x01;
 int flag;
 int t;
 
 for(t=0;t<8;t++)
 {
 
 flag = temp & mask;
 if(flag == 0)
 SERIAL_DATA = 0;
 else
 SERIAL_DATA = 1;
 SH_CP = 1;
 // delay_us(500);
 SH_CP = 0;
 // delay_us(500);
 mask = mask << 1;
 
 }
 ST_CP = 1;
 //delay_us(500);
 ST_CP = 0;
 //delay_us(500);
 }
 |  | 
	
		|  | 
	
		| Mike Walne 
 
 
 Joined: 19 Feb 2004
 Posts: 1785
 Location: Boston Spa UK
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Nov 22, 2015 5:59 am |   |  
				| 
 |  
				| It's been done loads of times on this forum and elsewhere. 
 1) Read the forum guidelines.
 2) Show us a schematic.
 3) Tell us your compiler version as well as PIC.
 4) Post the shortest possible complete and compilable code which shows your problem. (So we can copy and paste to test.)
 5) Explain what you can see and were expecting to happen.
 6) Learn to use the code button.
 
 Mike
 |  | 
	
		|  | 
	
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9589
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Nov 22, 2015 6:06 am |   |  
				| 
 |  
				| You should really post your entire program as there may be errors outside of the code 'snippet' you show in your post. 
 1) have you run a '1Hz LED' program to confirm your PIC really runs properly?
 
 2) create a small program using the 595 and 8 LEDs and confirm you can control/code/program access to it properly
 
 3) THEN add the 4017 and cut code as required.
 
 The idea is to start small, get code to function THEN proceed to the next 'layer' or 'feature' you want. Trying to do it all at once hard.
 
 Also with that PIC you could do an 8by8 matrix without the 595 and 4017 devices. Perhaps it might be an option, though you use a few more I/O pins.
 
 Jay
 |  | 
	
		|  | 
	
		|  |