Help needed for programming PIC16F877A...

ErnieM

Joined Apr 24, 2011
8,346
Hi,

I am working with 4017 connected through 877 for controling LED as per schematic the problem is that i am not getting how to control the Reset pin 15 of 4017 to avoid counting upto 10 i.e. stop at 8 only..??
First you look up the spec of the 4017 to see how to control the clock pin 14 and the reset pin 15 of the 4017.

Then you use the clock pin to "bit bang" the clock line to count up to the desired number.

Once you know you are at that number and want to "count back to zero" you hit the reset line instead of the clock line.
 

thatoneguy

Joined Feb 19, 2009
6,359
May I suggest searching for a "Beginning Programming in PIC C" course on the net?

You will then get everything from foundations to syntax, then loops, functions, and pointers. At that time, you would be an average programmer, but able to expand.


Everybody learns languages differently. I can't really think of a way to write a course to post here on learning C, that would have all the platforms covered, and still be understandable.

YES, it is money, but so is food, and our time. Members are doing the absolute best they can to help you, though you seem to find and attempt a different example without even reading the replies which members here have put time and effort into providing for you.

It appears that you are jumping from the "Hello World" of microcontrollers (blink an LED) straight to either an LED Cube or a scrolling display matrix. There is a world of difference between the two!
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Is this another project?

How does your code look?
Not like project just moving forward after using if else. foor loop to simple output to LEDs..

First you look up the spec of the 4017 to see how to control the clock pin 14 and the reset pin 15 of the 4017.

Then you use the clock pin to "bit bang" the clock line to count up to the desired number.

Once you know you are at that number and want to "count back to zero" you hit the reset line instead of the clock line.
Everything work fine while connecting the reset pin to serial output at 9 of 4017 but when i connect the uC to Led matrix it start from any Row but i want it to start from 1st Row only!!

the code i am writing is simple

TRISB=0X00;
PORTB=0B00101010;
LIKE THIS WORKING FINE BUT THE PROBLEM IS RESET..
 

ErnieM

Joined Apr 24, 2011
8,346
Everything work fine while connecting the reset pin to serial output at 9 of 4017 but when i connect the uC to Led matrix it start from any Row but i want it to start from 1st Row only!!

LIKE THIS WORKING FINE BUT THE PROBLEM IS RESET..
Of course you want that, so why don't you do that?

As you start, do the reset.
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Hi,

I have changed 4017 with 74164 shift register...for i am having problem with serial converting data to storage in 74164 then display while scanning. please tell how to do this??
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
OK, As i was talking about matrix display i want your suggestion which method should i use for scanning rows i have got 270 LED 3mm RED colours...??
1. 3 to 8 decoder
2. 4017
3. Or direct to PORTB,???
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
The code is working fine.....
please tell how to add string while selecting its array row column automatically..??



Rich (BB code):
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_XT);
#define _XTAL_FREQ 4000000
#define DAD PORTB
#define RST RD7
#define CLK RD4
#define DATA RD5
#define D 1
extern const unsigned char Font2[32][7];
int data(int a);
main (){
TRISD=0B00000000;
TRISB=0B00000000;
while(1){
DAD=0X00;
int a;

for(int i=1;i<32;i++){


for (int k=0;k<100;k++){
int o=0;
a=Font2[o];
data(a);
DAD=0X80;
__delay_ms(D);
o++;

a=Font2[o];
data(a);
DAD=0X40;
__delay_ms(D);
o++;
a=Font2[o];
data(a);
DAD=0X20;
__delay_ms(D);
o++;
a=Font2[o];
data(a);
DAD=0X10;
__delay_ms(D);
o++;
a=Font2[o];
data(a);
DAD=0X08;
__delay_ms(D);
o++;
a=Font2[o];
data(a);
DAD=0X04;
__delay_ms(D);
o++;
a=Font2[o];
data(a);
DAD=0X02;
__delay_ms(D);
o++;






}
}
}
}


int data(int a)
{
RST=0;
RST=1;

DAD=0X00;
for (int k=0; k<8;k++) {  
CLK = 0;  
    if ((a & 0x01)==1) DATA = 1;

    else DATA =0;

    CLK =1;

    a >>=1;
} }
 
Top