??? 02/23/08 06:00 Read: times |
#151318 - Best way to consolidate....out of memory |
I have to put 35 phrase's in here, I thought a structure might work, but I can't figure out the recursion to get it right. As it stand now the code is exactly working on the hardware but only 9 phrase can be store since I'm running out of space. I'm using the AT8S8252. Any thoughts? Thanks
#include <AT898252.H> #define high 1 //sets logic value of true #define low 0 //sets logic value of false sbit clear = P3^0; //sets port bit for functino control sbit write = P3^1; //sets port bit for functino control #define uint unsigned int #define uchar unsigned char void msec(uint x) // Time delay variable passed function to control time each word { uchar j; while (x-->0) {for(j=0;j<125;j++); } } void code clear_display() // Active low used to clear the display for startup and next phrase { clear=high; clear=low; clear=high; } void code write_enable() // Active low used to enable write sequence to the 7243 for each char { write=high; write=low; write=high; } void code word_delay() { msec(5500); // USER DELAY ADJUSTMENT => approximately a 5 second delay, moving value higher increase time delay } // Start copy and paste here for each new phrase > EACH PHRASE IS A FUNCTION AND MUST BE UNIQUE!! i.e. >> void code phrase1() > phrase2() > phrase3() > phrase..nn..() void code phrase1() { static unsigned char string1[]="CALIBRATE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase2() { static unsigned char string1[]="L. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase3() { static unsigned char string1[]="R. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase4() { static unsigned char string1[]="CMB "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase5() { static unsigned char string1[]="R. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase6() { static unsigned char string1[]="R. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase7() { static unsigned char string1[]="R. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase8() { static unsigned char string1[]="R. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void code phrase9() { static unsigned char string1[]="R. TURBINE "; // You must ensure that there are 10 chars INCLUDING WHITE SPACE or else @ will show up on display unsigned char z; // and phrase must be written in UPPERCASE LETTERS or else garbage will show up on display!!!! for (z=0;z<=9;z++) { P0 = (string1[z] & 0xBF); // Parse the data array for 10 array elements write_enable(); // Must strobe the write pin on the rising edge to latch char into memory position for each char in array } } void main() // Main program { clear_display(); //clear any startup junk incase of a power cycle glitch or who the hell knows what else during a power cycle > recurring function for(;;) // Loop this process forever { // Start copy and paste here for each new phrase clear_display(); phrase1(); word_delay(); // End copy and paste here > Avoid pasting these comments > Paste at the END of the list and INCREMENT THE PHRASE NUMBER OR ELSE IT WON'T SHOW UP!!!!! clear_display(); phrase2(); word_delay(); clear_display(); phrase3(); word_delay(); clear_display(); phrase4(); word_delay(); clear_display(); phrase5(); word_delay(); clear_display(); phrase6(); word_delay(); clear_display(); phrase7(); word_delay(); clear_display(); phrase8(); word_delay(); clear_display(); phrase9(); word_delay(); |