I have changes the sacnning from down left to rigt but the animation is not working it is hanging at starting only and scrolling is flickering/vibrating
Hi,
I want to write more lines but when i do this some overlapping occur due to which scrolling doesn't work well how to chose the value of x and 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 < 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
}
}
Each character is eight pixels wide so the whole string is 552 pixels so to scroll the whole string (using my code) you need to start at 32 and scroll to -520...
if i want to make this column scanning code to your row scanning then how to do convert/send buffer data??
Code:
#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
You have two complete sets of code.... One I posted ages ago that gives column scanning... The other is row scanning...
You don't understand the code at all, do you??? When I see that you are trying to output to PORTB in the display routine, just shows that this concept is more advanced than you can handle... You need to get your head around the interrupt and how it drives the display.... Until then you are not going to get my code working on your hardware..
OK, if i will change it to signed long then we can display more right?
and x will be always 32, y will be dependable on number of character then if by some mistake less character are there but y is more than it then what will happen?
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
}
}
Y in this function is just a counter The function strput( char*, x, y); The y in the function is fixed at 0..