scrolling text display (10x8)

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
Hi ,this is my 10x8 dot-matrix display program in HTC. Below is my program.

#include <htc.h>

__CONFIG(0x3F3B);

int a1,b1,c1,d1,e1,f1,g1,h1,i1,j1;

void begin(){(a1=0);(b1=0);(c1=0);(d1=0);(e1=0);(f1=0);(g1=0);(h1=0);(i1=0);(j1=0);}
void delay(unsigned int k){for(int i=0;i<=k;i++);}
void clock(){delay(20);PORTB=0;RA0=1;RA0=0;delay(10);}
void scroll(int a,b,c,d,e)
{
(a=~a);(b=~b);(c=~c);(d=~d);(e=~e);
int t;(t=0);


loop1a1=a);
for(int i=0;i<=50;i++)
{
PORTB=a1;clock();
PORTB=b1;clock();
PORTB=c1;clock();
PORTB=d1;clock();
PORTB=e1;clock();
PORTB=f1;clock();
PORTB=g1;clock();
PORTB=h1;clock();
PORTB=i1;clock();
PORTB=j1;clock();
}
(j1=i1);(i1=h1);(h1=g1);(g1=f1);(f1=e1);(e1=d1);(d1=c1);(c1=b1);(b1=a1);
(a=b);(b=c);(c=d);(d=e);(t=t+1);if(t==5){(a=0);}if(t==6){goto exit;}
goto loop1;

exit:;
}

//FONT//
void A(){scroll(0xC1, 0xB7, 0x77, 0xB7, 0xC1);} //letter A
void B(){scroll(0x01, 0x6D, 0x6D, 0x6D, 0x93);}
void C(){scroll(0x83, 0x7D, 0x7D, 0x7D, 0xBB);}
void D(){scroll(0x01, 0x7D, 0x7D, 0xBB, 0xC7);}
void E(){scroll(0x01, 0x6D, 0x6D, 0x6D, 0x7D);}
void F(){scroll(0x01, 0x6F, 0x6F, 0x6F, 0x7F);}
void G(){scroll(0x83, 0x7D, 0x65, 0x6D, 0xA3);}
void H(){scroll(0x01, 0xEF, 0xEF, 0xEF, 0x01);}
void I(){scroll(0x7D, 0x7D, 0x1, 0x7D, 0x7D);}
void J(){scroll(0xF3, 0x7D, 0x7D, 0x03, 0x7F);}
void K(){scroll(0x01, 0xEF, 0xD7, 0xBB, 0x7D);}
void L(){scroll(0x01, 0xFD, 0xFD, 0xFD, 0xFD);}
void M(){scroll(0x01, 0xBF, 0xDF, 0xBF, 0x01);}
void N(){scroll(0x01, 0xBF, 0xDF, 0xEF, 0x01);}
void O(){scroll(0x83, 0x7D, 0x7D, 0x7D, 0x83);}
void P(){scroll(0x01, 0x6F, 0x6F, 0x6F, 0x9F);}
void Q(){scroll(0x83, 0x7D, 0x75, 0x79, 0x81);}
void R(){scroll(0x01, 0x6F, 0x6F, 0x6F, 0x91);}
void S(){scroll(0x9B, 0x6D, 0x6D, 0x6D, 0xB3);}
void T(){scroll(0x7F, 0x7F, 0x01, 0x7F, 0x7F);}
void U(){scroll(0x03, 0xFD, 0xFD, 0xFD, 0x03);}
void V(){scroll(0x07, 0xFB, 0xFD, 0xFB, 0x07);}
void W(){scroll(0x01, 0xFB, 0xF7, 0xFB, 0x01);}
void X(){scroll(0x39, 0xD7, 0xEF, 0xD7, 0x39);}
void Y(){scroll(0x3F, 0xDF, 0xE1, 0xDF, 0x3F);}
void Z(){scroll(0x79, 0x75, 0x6D, 0x5D, 0x3D);} //letter Z
void D0(){scroll(0x83, 0x7D, 0x7D, 0x7D, 0x83);} //NUM 0
void D1(){scroll(0xDD, 0xBD, 0x1, 0xFD, 0xFD);}
void D2(){scroll(0xBD, 0x79, 0x75, 0x6D, 0x9D);}
void D3(){scroll(0x7B, 0x7D, 0x5D, 0x4D, 0x33);}
void D4(){scroll(0xCF, 0xAF, 0x6F, 0xEF, 0x1);}
void D5(){scroll(0xB, 0x5D, 0x5D, 0x5D, 0x63);}
void D6(){scroll(0x83, 0x6D, 0x6D, 0x6D, 0xB3);}
void D7(){scroll(0x79, 0x77, 0x6F, 0x5F, 0x3F);}
void D8(){scroll(0x93, 0x6D, 0x6D, 0x6D, 0x93);}
void D9(){scroll(0x9B, 0x6D, 0x6D, 0x6D, 0x83);} //NUM 9





void main()
{
TRISB=0;TRISA=0b11100;PORTA=0;PORTA=2;PORTA=1;PORTA=0;PORTB=0;begin();delay(10);begin();
while(1)
{ //text to display//
A();B();C();D();E();F();G();H();I();J();K();L();M();N();O();P();Q();R();S();T();U();V();W();X();Y();Z();
D0();D1();D2();D3();D4();D5();D6();D7();D8();D9();


}

}
/////////////////////////////////////////////////////////////////////
.here it displays A to Z and 0 to 9 and it repeats....
.
now, (am new to C programming and have some doubts)
1>Is my program a simple one? I mean, could i make it little bit more simpler by editing so that i could save the program and data space in my PIC.

2>Is this the right way for making scrolling display ?

3>here , to display a text ,for eg: VINOD, I should give
V();I();N();O();D(); inside main.
Is there any alternate method so that i could just type VINOD to display it?
 

you can just add one more function
for example:

void display(char *text)
{
int i=0;
while(text!='\0')
{
switch(text)
{
case 'A':
A();
break;
case 'B':
B();
break;
/*
go on adding all the functions in similar manner.........
*/
}
i++;
}
}

using this function you can just call all the functions easily as you wish.
like:
display("TEXT")
would call the function
T();
E();
X() and
T();
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…