lloydi12345
Member level 4
Hi, I've read an article from this site Lab 15: Scrolling text message on an LED dot-matrix display :Embedded Lab. Unfortunately it didn't worked in proteus so I tried making another codes and redesigning the schematic from the easiest level. I'm using my columns as my scanners and rows as the pattern generators. Here's my schematic:
The problem here is that I don't know how to send the individual bits on the 1st array's row (letter A) which is 0b00000000(this is for 0x00) to my_data then followed by 0b11111110(this is for 0xFE) and so on until 0x00. There's no problem sending values to my_data if I'm using array that is composed of binaries but when I use hexadecimals I can't make it work.
I would be so grateful for some help.
The problem here is that I don't know how to send the individual bits on the 1st array's row (letter A) which is 0b00000000(this is for 0x00) to my_data then followed by 0b11111110(this is for 0xFE) and so on until 0x00. There's no problem sending values to my_data if I'm using array that is composed of binaries but when I use hexadecimals I can't make it work.
Code:
//LED dot matrix display
//columns used for scanning
//rows used for generating patterns
// Definitions
sbit my_data at RC2_bit;
sbit clock at RC6_bit;
sbit latch at RC7_bit;
const unsigned short one[2][8] = {{0x00, 0xFE, 0x11, 0x11, 0x11, 0xFE, 0x00, 0x00}, //A
{0x00, 0xFF, 0x89, 0x89, 0x89, 0x76, 0x00, 0x00} //B
};
unsigned int row, column, scanner, repeat;
void main() {
CMCON = 0x07; // Disable comparators
ADCON0 = 0x00;
ADCON1 = 0x0F;
TRISC = 0x00;
TRISD = 0x00;
my_data = 1;
scanner = 1;
row = 0;
column = 0;
while(1){
for (column = 0; column < 2; column++){
for (row = 0; row < 8; row++){
my_data = one[column][row];
clock = 1;
clock = 0;
scanner = 1;
for (repeat = 0; repeat < 8; repeat++){
latd = scanner;
scanner = scanner << 1;
}
}
latch = 1;
latch = 0;
}
}
}
I would be so grateful for some help.