??? 03/06/09 04:59 Modified: 03/06/09 05:29 Read: times |
#163134 - Code, problem, information and schematic. Responding to: ???'s previous message |
This is my technique of scrolling: review it and suggest. Actually with due respect, i m not getting you technique of circular buffer.
Sir Per i understand it :http://8052.com/forum/read/162903. Please forgive me and help me on this. I think that's all the information of my project but anybody still need more information or feedback, please do inform me. And please forgive my English. Hardware: Shift Register: BU4094 Micro controller: AT89S52 BDX54C as transistor 11.0592 MHz crystal. Problem: As more and more characters scroll on display, speed slows down and flickering is there. If one character is scrolled one by one (asking Micro controller to load only 1 character to scroll and then only 2nd character (instead of whole message) then display did not slows down (it would have worked for me if I was making a just 8x8 display) but this is not the solution to me as I have to display at least 10 characters at a time on a (16x80) display. I was going to use HEF4094 as Shift Register but unfortunately can’t get it. (Tell me if this BU4094 is slow in loading data and causing my display to slow down and flicker? what you say?) I am testing on an 8x8 display but utilizing only 25 leds (5x5) due to some hardware limitations. I used timer 0 interrupt but it did not work for me as again the problem was there (As more and more characters scroll on display, speed slows down and flickering is there). The schematic being used is this one: ![]() Anodes of leds=rows Cathodes=columns replace IC 74164=BU4094 and an example of technique: Row Scanning Technique: (Brackets’ text shows loops and variables used in code) 1. Save the Message to be displayed in code memory (msg_org). 2. Define an array of 35 bits (this is for 7 characters on a 5x5 matrix, later it will be of 80 bits) which is used to save the row information to be displayed (row_buff). 3. Get first character of Message (word) 4. Identify character (using switch statement) and get character data. 5. Add one bit (if this is first character) to row_buff (col). 6. If this the first row then OFF (give 0 to) it (1s are given from shift register). 7. EO of shift register is ON to illuminate the first row. 8. Delay. 9. EO of shift register is OFF. 10. Row is also ON (give 1 to it) so that now this row is OFF 11. Clear the shift register 12. Repeat steps ‘3’ to ‘11’ 5 times so that all 5 rows are illuminated (turned on and then off one by one (row)). 13. Repeat steps ‘3’ to ‘11’ 7 times (using loop1 so that 1st column is illuminated) 14. Now column (loop) value is 2 (means now it will add 2 column bits of character) 15. Identify character (using switch statement) and get character data. 16. Add two bits (if this is first character) to row_buff. 17. If this the first row then OFF (give 0 to) it (1s are given from shift register). 18. EO of shift register is ON to illuminate the first row. 19. Delay. 20. EO of shift register is OFF. 21. Row is also ON so that now this row is OFF 22. Clear the shift register 23. Repeat steps ‘4’ to ‘11’ 5 times so that all 5 rows are illuminated (turned on and then off one by one (row)). 24. Repeat steps ‘3’ to ‘11’ 7 times (using loop1 so that 2 columns are illuminated) 25. Now column (loop) value is 3 (means now it will add 2 column bits of character) 26. Identify character (using switch statement) and get character data. 27. Add three bits (if this is first character) to row_buff. 28. If this the first row then OFF (give 0 to) it (1s are given from shift register). 29. EO of shift register is ON to illuminate the first row. 30. Delay. 31. EO of shift register is OFF. 32. Row is also ON so that now this row is OFF 33. Clear the shift register 34. Repeat steps ‘4’ to ‘11’ 5 times so that all 5 rows are illuminated (turned on and then off one by one (row)). 35. Repeat steps ‘3’ to ‘11’ 7 times (using loop1 so that 3 columns are illuminated) In this way first character is illuminated. 36. Get 2 character of Message (word) 37. Identify first character (using switch statement) and get character data. 38. Add 5 bits (as this is NOT the first character) to row_buff (col). 39. Identify 2nd character (using switch statement) and get character data. 40. Add 1 bit (as this is the 2nd character) to row_buff (col). 41. If this the first row then OFF (give 0 to) it (1s are given from shift register). 42. EO of shift register is ON to illuminate the first row. 43. Delay. 44. EO of shift register is OFF. 45. Row is also ON (give 1 to it) so that now this row is OFF 46. Clear the shift register 47. Repeat steps ‘36’ to ‘48’ 5 times so that all 5 rows are illuminated (turned on and then off one by one (row)). 48. Repeat steps ‘36’ to ‘48’ 7 times (using loop1 so that 6 columns are illuminated) 49. Identify first character (using switch statement) and get character data. 50. Add 5 bits (as this is NOT the first character) to row_buff (col). 51. Identify 2nd character (using switch statement) and get character data. 52. Add 2 bits (as this is the 2nd word) to row_buff (col). 53. If this the first row then OFF (give 0 to) it (1s are given from shift register). 54. EO of shift register is ON to illuminate the first row. 55. Delay. 56. EO of shift register is OFF. 57. Row is also ON (give 1 to it) so that now this row is OFF 58. Clear the shift register 59. Repeat steps ‘49’ to ‘58’ 5 times so that all 5 rows are illuminated (turned on and then off one by one (row)). 60. Repeat steps ‘49’ to ‘58’ 7 times (using loop1 so that 1st column is illuminated) And so on till loop (loop_words) is not over. Now the code: #include <reg51.h> code unsigned int row_data1[5][5]={ {0,1,1,1,0}, {0,1,0,1,0}, {0,1,0,1,0}, {0,1,1,1,0}, {0,1,0,1,0} }; code unsigned int row_data2[5][5]={ {0,1,1,1,0}, {0,1,0,1,0}, {0,1,1,1,0}, {0,1,0,1,0}, {0,1,1,1,0} }; code unsigned int row_data3[5][5]={ {0,1,1,1,0}, {0,1,0,0,0}, {0,1,0,0,0}, {0,1,0,0,0}, {0,1,1,1,0} }; code unsigned int row_data4[5][5]={ {1,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,1,1,0} }; code unsigned int row_data5[5][5]={ {0,1,1,1,1}, {0,1,0,0,0}, {0,1,1,1,1}, {0,1,0,0,0}, {0,1,1,1,1} }; code unsigned int row_data6[5][5]={ {0,1,1,1,1}, {0,1,0,0,0}, {0,1,1,1,1}, {0,1,0,0,0}, {0,1,0,0,0} }; code unsigned int row_data7[5][5]={ {0,0,1,1,1}, {0,1,0,0,0}, {0,1,0,1,0}, {0,1,0,0,1}, {0,0,1,1,0} }; //space code unsigned int row_data8[5][5]={ {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0} }; sbit P2_0 = P2^0; sbit P2_1 = P2^1; sbit P2_2 = P2^2; sbit P2_3 = P2^3; sbit P2_4 = P2^4; sbit P2_5 = P2^5; sbit P2_6 = P2^6; sbit P2_7 = P2^7; sbit P1_0 = P1^0; sbit P1_1 = P1^1; sbit P1_2 = P1^2; sbit P1_3 = P1^3; unsigned char word; unsigned char i; unsigned char row_data[5][5]; unsigned char loop_words; unsigned char loop; unsigned char loop1; unsigned char row; unsigned char d; unsigned char col; unsigned char row_buff[30]; code unsigned char msg_org[7]={"ABCDEFG"}; void main() { while (1) { //Clr the shift register P1_1=0; for (d=0;d<8;d++){ //clock P1_2=0; P1_2=1; } d=0; //strobe of shift register BU4094 is off. P1_0=0; //EO of shift register is also off. P1_3=0; for (loop_words=0;loop_words<7;loop_words++) {//the main loop for (loop=0;loop<5;loop++) {//this is to select column data for (loop1=0;loop1<7;loop1++) {//this loop refreshes the display for (row=0;row<=5;row++)//for selection of rows { for (word=0;word<=loop_words;word++)//This loop make it sure that initially 1st word is selected //then 2 words and then 3 words of the original msg { switch(msg_org[word]) { case 'A': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data1[i][d]; } } break; case 'B': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data2[i][d]; } } break; case 'C': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data3[i][d]; } } break; case 'D': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data4[i][d]; } } break; case 'E': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data5[i][d]; } } break; case 'F': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data6[i][d]; } } break; case 'G': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data7[i][d]; } } break; case ' ': for (i=0;i<5;i++) { for (d=0;d<5;d++) {row_data[i][d]=row_data8[i][d]; } } break; } if (word==loop_words)//if this is first word then add only one bit to row_buff { for (col=0;col<=loop;col++) { row_buff[d]=row_data[row][col]; P1_1=row_buff[d] ; //clock P1_2=0; P1_2=1; d=d+1; } }//if loop words==0 else//Now if word are more than 1 (i.e; loop_words>0) than add 5 bits of 1st character { for (col=0;col<=4;col++) { row_buff[d]=row_data[row][col]; P1_1=row_buff[d] ; //clock P1_2=0; P1_2=1; d=d+1; }//for if }//for word loop if (row==0)//if this the first row then off it so that it can be illuminated P2_0=0 ; if (row==1)//if this the 2nd row then off it so that it can be illuminated P2_1=0 ; if (row==2) //if this the 3rd row then off it so that it can be illuminated P2_2=0; if (row==3)//if this the 4th row then off it so that it can be illuminated P2_3=0; if (row==4) //if this the 5th row then off it so that it can be illuminated P2_4=0; //strobe to shift register P1_0=1; //EO enable P1_3=1; // delay so that the leds can be illuminated fo a while for (d=0;d<250;d++) { } d=0; //clr strobe P1_0=0; //clr EO P1_3=0; //row is shut-off P2=0xFF; //clr the SR P1_1=0; for (d=0;d<8;d++){ //clock P1_2=0; P1_2=1; } }//for row }//fr loop1 }//for loop }//for loop_words }//while }//main |