I have changed my Simulation to 16x32 leds.... Its working brilliantly... I'm making a few animations to show it off....
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void displaystring(void) // this routine prints through the screen buffer
{ // moving one pixel at a time
signed char x=32,y=0; // I made these signed so I could print
for(y = 0;y < 300 ;y++) // to nowhere so I could produce the scrolling effect
{
clr(); // Clear the display buffer
strput("WELCOME TO SHIVALIK COLLEGE OF ENGINEERING, ELECTRICAL & ELECTRONICS ",x--,0); // adjust the scrolling string
Blit(); // pass to screen buffer
__delay_ms(80); // time to view
}
}
WELCOME TO SHIVALIK COLLEGE OF ENGINEERING, ELECTRICAL & ELECTRONICS
so, x will be always 32???
and y will be 8x character
Ok, if we have more character like 50 then we have to 400 value of x or y?? i have seen at large character it overlap!
Yes because the code I posted was for smaller strings.
#include<pic.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
#define DAD PORTB
#define RST RD7
#define CLK RC3
#define DATA RC4
char displayPointer=0;
extern const char font[];
unsigned char buffer[32]; // buffer for screen
void interrupt ISR() // This just swaps the buffer to the display
{
if(TMR2IF) // make sure its the timer interrupt.
{
PORTB = 0; // clear old data first
if(displayPointer == 0 ) // 1st frame..
DATA = 1; // Data = 1 on the first clock
CLK = 1;
__delay_us(10); // Clock the shift registers
CLK = 0;
DATA = 0;
PORTB = buffer[displayPointer]; // Move budffer line by line
if(++displayPointer==31) // 24 LED columns
displayPointer = 0; // back to first..
}
TMR2IF = 0;
}
void display(const char* str)
{
int addr;
char x, y;
while(*str != 0) // while there is still characters
{
addr = (int) *str++ - 0x20; // get character
// DAD=addr;
addr *=5;
//DAD=addr;
for(y=0;y<5;y++) // 5x8 font so 5 columns
{
buffer[31] = font[addr++]; // put it in buffer
for(x=0;x<32;x++)
{
buffer[x] = buffer[x+1]; // shift all the columns <--
//DAD=buffer[x];
__delay_ms(4); // so you can see it
}
}
buffer[31] = 0; // This is the scpace between
for(x=0;x<32;x++) // the characters.. Or they will be too close
{
buffer[x] = buffer[x+1]; // shift the space in
__delay_ms(5);
} // NOTE!!! your array is 28 not 24 like mine
}
}
void main(void)
{
ADCON1 = 0x6;
T2CON = 0x1e;
PR2 = 50; // timer preload value
TMR2IE = 1; // enable timer 2 interrupt
PEIE = 1; // enable peripheral interrupt
GIE = 1; // enableglobal interrupt
TRISB = 0; // Port B as output...
TRISC = 0;
RST=1; // Port C as ouput...
while(1)
{
display("WELCOME "); // Here's the message
}
} // End main
If you change x and y to signed int's you can use strings up to 127 characters long...
then here the value of y should be changed?? according to number of character?
Code:for(y = 0;y < 300 ;y++)
void displaystring(void) // this routine prints through the screen buffer
{ // moving one pixel at a time
signed char x=32,y=0; // I made these signed so I could print
for(y = 0;y < 96 ;y++) // to nowhere so I could produce the scrolling effect
{
clr(); // Clear the display buffer
strput("HELLO WORLD!!",x--,0); // adjust the scrolling string
Blit(); // pass to screen buffer
__delay_ms(80); // time to view
}
}
13 characters... so this will scroll 96 times...