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

DOT matrix display using 74hc595 & cd4017 in pic16f877a

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



Joined: 22 Nov 2015
Posts: 1

View user's profile Send private message

DOT matrix display using 74hc595 & cd4017 in pic16f877a
PostPosted: Sun Nov 22, 2015 4:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 22, 2015 5:59 am     Reply with quote

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: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 22, 2015 6:06 am     Reply with quote

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
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