Discussion in "Project Help" started by    Billz    Jan 11, 2020.
Sat Jan 11 2020, 11:13 pm
#1
hi everyone please attached files are my c code for scrolling message but it is not working as expecting,,,so kindly please help me
i shall be very grateful to all of you
#include"ConfigBits.h"
#include<pic16f877a.h>
#define _XTAL_FREQ 12000000

#define clk PORTCbits.RC4
#define latch PORTCbits.RC5
#define ds PORTCbits.RC6

#define clkr PORTDbits.RD0 // (-)
#define latchr PORTDbits.RD1
#define dsr PORTDbits.RD2

unsigned char alph[2][5]={{0xFF,0xFF,0xFF,0xFF,0xFF},
{0x83,0xf5,0xf6,0xf5,0x83}};

//unsigned char alph[5]={0x83,0xf5,0xf6,0xf5,0x83};

unsigned char scrollspeed=10;
void off_the_col()
{
unsigned char m;
for(m=0;m<=7;m++)
{

clk=0; latch=0;
ds=0;
clk=1; latch=1;
}
}
void col_scan(unsigned char colpos)
{
unsigned char m,n;
for(m=0;m<=7;m++)
{
clk=0; latch=0;
if(m==colpos)
ds=1;
else
ds=0;
clk=1; latch=1;
}
__delay_ms(1);
off_the_col();
}


void main()
{
TRISCbits.TRISC4=0;
TRISCbits.TRISC5=0;
TRISCbits.TRISC6=0;
TRISDbits.TRISD0=0;
TRISDbits.TRISD1=0;
TRISDbits.TRISD2=0;
unsigned char row,j,dataRow,col,z,i,r,c;
while(1)
{
for(row=0;row<2;row++)
{
for(i=0;i<8;i++)
{
for(z=0;z<=scrollspeed;z++)
{
for(col=0;col<=15;col++)
{
for (j=0;j<=7;j++)
{
c=i+col;
dataRow=(alph[row][c]<<j)&0x80;
clkr=0; latchr=0;
if(dataRow==0)
dsr=dataRow;
else
dsr=1;
clkr=1; latchr=1;
__delay_ms(1);
}
col_scan(col);
}//col
}//z
}//i
}//row


}//while
}
Sat Jan 18 2020, 03:54 am
#2
We will need the circuit diagram.
A Proteus simulation would be much better.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

EdwardFew
Mon Mar 18 2024, 01:14 pm
EmeryPah
Mon Mar 18 2024, 11:51 am
RobertMax
Sun Mar 17 2024, 10:22 pm
DanielJar
Fri Mar 15 2024, 06:52 pm
Tuzaimecor
Fri Mar 15 2024, 02:32 am
PromotionFoode
Thu Mar 14 2024, 08:11 pm
EdwardGeawn
Sun Mar 10 2024, 12:24 pm
ZacharyShado
Sat Mar 09 2024, 10:04 am