??? 02/19/08 01:12 Read: times |
#151083 - argggg....I'm stuck again.....:( |
I've got my display to work exactly as I want it to, but I'm having a problem with a buffer flush routine. My D7 bit is used for active low to clear the decoder buffer after the string is write to the display. The sequence should be:
Write string to display (check) Wait a specified time (check) Clear buffer by toggling bit 7 (error) Write next string in sequence to display (error) Repeat process for all subsequent strings (not getting this far). If I do just one string, it writes and I can force a clear via software with a clear.hex file with direct control on the bit (proving hardware and software toggle functions as expected). I want the FOR loop to repeat the process for all the sub string function blocks, but it "looks" like its stuck at doing only the first string and never getting to the next string. I've tried to add a clear toggle after the first string } for loop closure, but all the does is just turn off the displays completely, which I think is a structure problem. Here is the code, can anyone see my issue? #include <reg51.h> sbit clear = P0^7; void flush_data() { clear=0; clear=1; clear=0; } void word_delay() { unsigned int x; for(x=0;x<15000;x++); } main() { while(1) { { unsigned char string1[]="RUN"; // 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<=2;z++) { P0 = (string1[z] & 0xBF)| 0x80; // Data out, bit 6 low P0 = (string1[z] & 0x3F)| 0xC0; // Bit 6 high P0 = string1[z] & 0x3F | 0x80; // Bit 6 low again } word_delay(); flush_data(); } { unsigned char string1[]="BOOST"; // 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<=4;z++) { P0 = (string1[z] & 0xBF)| 0x80; // Data out, bit 6 low P0 = (string1[z] & 0x3F)| 0xC0; // Bit 6 high P0 = string1[z] & 0x3F | 0x80; // Bit 6 low again } word_delay(); flush_data(); } } } |
Topic | Author | Date |
argggg....I'm stuck again.....:( | 01/01/70 00:00 | |
The clear bit is wron way around. | 01/01/70 00:00 | |
Esko..Just verified clear bit | 01/01/70 00:00 | |
What is the execution order ? | 01/01/70 00:00 | |
Verified the order execution | 01/01/70 00:00 | |
So it is the sbit thing that is hurting You now. | 01/01/70 00:00 | |
Correction: Place the CALL before data loop | 01/01/70 00:00 | |
A few suggestions for Your code | 01/01/70 00:00 | |
I will adapt some of it, thank you | 01/01/70 00:00 | |
I (don\'t) C | 01/01/70 00:00 | |
Make life easier![]() | 01/01/70 00:00 |