bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
to make sure both HC154 don't work at the same time, please try this :
Code:sbit E1 at P3_0_bit; sbit E2 at P3_1_bit; void main() { unsigned char a; unsigned char x; unsigned char y; unsigned char z; code unsigned char font[88]= { // 0 1 2 3 4 5 6 7 8 9 10 0x3C,0x3C,0x84,0x81,0x10,0x8F,0x60,0x81,0x66,0x46,0x00, 0x42,0x00,0xC2,0x89,0x18,0x89,0x90,0x41,0x99,0x89,0x00, 0xA1,0x00,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00, 0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00, 0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00, 0x85,0x06,0x91,0x89,0x11,0x89,0x91,0x05,0x99,0x89,0x00, 0x42,0x04,0x89,0x49,0xFF,0x89,0x90,0x03,0x99,0x89,0x00, 0x3C,0x00,0x86,0x36,0x10,0x71,0x60,0x01,0x66,0x7E,0x00 }; unsigned char display [4] = {5,6,7,8}; do { for (z=0;z<100;z++) { for (x=0;x<2;x++) //2 characters { for (y=0;y<8;y++ ) //each character contains 8 cols. { a=(x*8)+y; // 8 cols P1=a; E1=0; E2=1; a=(y*11)+display[x]; P2 = font[a]; delay_us(500); }; }; }; for (z=0;z<100;z++) { for (x=2;x<4;x++) //2 characters { for (y=0;y<8;y++ ) //each character contains 8 cols. { a=(x*8)+y; // 8 cols P1=a; E1=1; E2=0; a=(y*11)+display[x]; P2 = font[a]; delay_us(500); }; }; }; } while(1); // Endless loop }
It will show :
1st and 2nd character will show 5 and 6 while 3rd and 4th are off.
then after about one second :
3rd and 4th character will show 7 and 8 while 1st and 2nd are off.
and please check the voltage at microcontroller port 3.0 and port3.1. Its should be a pulse.
hey, wait, Port 3.0 and 3.1? You don't use these pins for UART, do you? if you did, please use another pins.
Good idea mate,
Let me have a try.....
May be I will get the luck this time....
---------- Post added at 04:11 ---------- Previous post was at 03:21 ----------
to make sure both HC154 don't work at the same time, please try this :
Code:sbit E1 at P3_0_bit; sbit E2 at P3_1_bit; void main() { unsigned char a; unsigned char x; unsigned char y; unsigned char z; code unsigned char font[88]= { // 0 1 2 3 4 5 6 7 8 9 10 0x3C,0x3C,0x84,0x81,0x10,0x8F,0x60,0x81,0x66,0x46,0x00, 0x42,0x00,0xC2,0x89,0x18,0x89,0x90,0x41,0x99,0x89,0x00, 0xA1,0x00,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00, 0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00, 0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00, 0x85,0x06,0x91,0x89,0x11,0x89,0x91,0x05,0x99,0x89,0x00, 0x42,0x04,0x89,0x49,0xFF,0x89,0x90,0x03,0x99,0x89,0x00, 0x3C,0x00,0x86,0x36,0x10,0x71,0x60,0x01,0x66,0x7E,0x00 }; unsigned char display [4] = {5,6,7,8}; do { for (z=0;z<100;z++) { for (x=0;x<2;x++) //2 characters { for (y=0;y<8;y++ ) //each character contains 8 cols. { a=(x*8)+y; // 8 cols P1=a; E1=0; E2=1; a=(y*11)+display[x]; P2 = font[a]; delay_us(500); }; }; }; for (z=0;z<100;z++) { for (x=2;x<4;x++) //2 characters { for (y=0;y<8;y++ ) //each character contains 8 cols. { a=(x*8)+y; // 8 cols P1=a; E1=1; E2=0; a=(y*11)+display[x]; P2 = font[a]; delay_us(500); }; }; }; } while(1); // Endless loop }
It will show :
1st and 2nd character will show 5 and 6 while 3rd and 4th are off.
then after about one second :
3rd and 4th character will show 7 and 8 while 1st and 2nd are off.
and please check the voltage at microcontroller port 3.0 and port3.1. Its should be a pulse.
hey, wait, Port 3.0 and 3.1? You don't use these pins for UART, do you? if you did, please use another pins.
I didn't use P3.0 and P3.1 for UART, it's free, so far I can see in my code....
---------- Post added at 04:12 ---------- Previous post was at 04:11 ----------
to make sure both HC154 don't work at the same time, please try this :
Code:sbit E1 at P3_0_bit; sbit E2 at P3_1_bit; void main() { unsigned char a; unsigned char x; unsigned char y; unsigned char z; code unsigned char font[88]= { // 0 1 2 3 4 5 6 7 8 9 10 0x3C,0x3C,0x84,0x81,0x10,0x8F,0x60,0x81,0x66,0x46,0x00, 0x42,0x00,0xC2,0x89,0x18,0x89,0x90,0x41,0x99,0x89,0x00, 0xA1,0x00,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00, 0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00, 0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00, 0x85,0x06,0x91,0x89,0x11,0x89,0x91,0x05,0x99,0x89,0x00, 0x42,0x04,0x89,0x49,0xFF,0x89,0x90,0x03,0x99,0x89,0x00, 0x3C,0x00,0x86,0x36,0x10,0x71,0x60,0x01,0x66,0x7E,0x00 }; unsigned char display [4] = {5,6,7,8}; do { for (z=0;z<100;z++) { for (x=0;x<2;x++) //2 characters { for (y=0;y<8;y++ ) //each character contains 8 cols. { a=(x*8)+y; // 8 cols P1=a; E1=0; E2=1; a=(y*11)+display[x]; P2 = font[a]; delay_us(500); }; }; }; for (z=0;z<100;z++) { for (x=2;x<4;x++) //2 characters { for (y=0;y<8;y++ ) //each character contains 8 cols. { a=(x*8)+y; // 8 cols P1=a; E1=1; E2=0; a=(y*11)+display[x]; P2 = font[a]; delay_us(500); }; }; }; } while(1); // Endless loop }
It will show :
1st and 2nd character will show 5 and 6 while 3rd and 4th are off.
then after about one second :
3rd and 4th character will show 7 and 8 while 1st and 2nd are off.
and please check the voltage at microcontroller port 3.0 and port3.1. Its should be a pulse.
hey, wait, Port 3.0 and 3.1? You don't use these pins for UART, do you? if you did, please use another pins.
May be just change P3.0 and P3.1 to P3.2 and P3.3, but I don't think it will help....
---------- Post added at 05:46 ---------- Previous post was at 04:12 ----------
Mate,
It's not 5 6 7 8 but 5 6 and strange characters,
you can see on the video