/*
Trial1 displaying matrix
*/
sbit clock_a at rc0_bit;
sbit data_a at rc1_bit;
sbit latch_a at rc2_bit;
sbit clock_b at rd6_bit;
sbit reset at rd7_bit;
sbit enable at rd5_bit;
const unsigned short arrays[][8] = {{0xFF,0xFF,0x80,0x77,0x77,0x77,0x80,0xFF}
};
unsigned int scanner, scanner2, scantime, disp, row, column, mask, repeat;
void main() {
LATC = 0x00;
CMCON = 0x07;
ADCON0 = 0x00;
ADCON1 = 0x0F;
TRISC = 0x00;
TRISD = 0x00;
scanner2 = 0;
while(1) {
for(column=0;column<1;column++){
for (repeat=0;repeat<80;repeat++){
for(row=0;row<8;row++){
disp = arrays[column][row];
mask = 0x01;
for (scantime=0;scantime<8;scantime++){
scanner = mask & disp;
if (scanner==0)
data_a = 0;
else data_a = 1;
mask = mask << 1;
clock_a = 1;
clock_a = 0;
}
latch_a = 1;
latch_a = 0;
clock_b = 1;
clock_b = 0;
delay_us(100);
}
}
}
}
}
Which variable that you store what you are want to display?
I have done before, I do shifting that variable.
array[7]=0b0000000000000000;
array[6]=0b0000000000000000;
array[5]=0b0000000000000000;
array[4]=0b0000000000000000;
array[3]=0b0000000000000000;
array[2]=0b0000000000000000;
array[1]=0b0000000000000000;
array[0]=0b0000000000000000;
for(i=7;i>=0;i--) array=(array<<1)|((temp[j]>>i)&0x01);
/*
Trial1 displaying matrix
*/
sbit clock_a at rc0_bit;
sbit data_a at rc1_bit;
sbit latch_a at rc2_bit;
sbit clock_b at rd6_bit;
sbit reset at rd7_bit;
sbit enable at rd5_bit;
const unsigned long int arrays[][8] = {{0b11111111,0b11111111,0b10000000,0b01110111,0b01110111,0b01110111,0b10000000,0b11111111},
{0b11111111,0b10000000,0b01110111,0b01110111,0b01110111,0b10000000,0b11111111,0b11111111},
{0b10000000,0b01110111,0b01110111,0b01110111,0b10000000,0b11111111,0b11111111,0b11111111},
{0b01110111,0b01110111,0b01110111,0b10000000,0b11111111,0b11111111,0b11111111,0b10000000},
{0b01110111,0b01110111,0b10000000,0b11111111,0b11111111,0b11111111,0b10000000,0b01110111},
{0b01110111,0b10000000,0b11111111,0b11111111,0b11111111,0b10000000,0b01110111,0b01110111},
{0b10000000,0b11111111,0b11111111,0b11111111,0b10000000,0b01110111,0b01110111,0b01110111},
{0b11111111,0b11111111,0b11111111,0b10000000,0b01110111,0b01110111,0b01110111,0b10000000},
};
unsigned int scanner, scanner2, scantime, disp, row, column, mask, repeat;
void main() {
LATC = 0x00;
CMCON = 0x07;
ADCON0 = 0x00;
ADCON1 = 0x0F;
TRISC = 0x00;
TRISD = 0x00;
scanner2 = 0;
while(1) {
for(column=0;column<8;column++){
for (repeat=0;repeat<50;repeat++){
for(row=0;row<8;row++){
disp = arrays[column][row];
mask = 0x01;
for (scantime=0;scantime<8;scantime++){
scanner = mask & disp;
if (scanner==0)
data_a = 0;
else data_a = 1;
mask = mask << 1;
clock_a = 1;
clock_a = 0;
}
latch_a = 1;
latch_a = 0;
clock_b = 1;
clock_b = 0;
delay_ms(1);
}
}
}
}
}
Only that I can give. The array[7] to array[0] to store display content. Then, my Timer Interrupt will do the blinking. I'm just scrolling this variable to get display scrolling.Thanks engshahrul but I don't get it. Can you expand it more?
That is up to 16X8 matrix. I use direct I/O, no expend I/O using other IC.I think I already know what you're showing to me. Is that applicable only until 4 led matrices. I would like to extend it like 6 to 8.
If scanning you mean switching, of course it need to do switching line-by-line. I just ON 1 line per time. The blinking is 1/8. I count 0-7 for sending this line in the interrupt.Oh I see but I don't think you are using the scanning method? are you also scanning? and you're not using a shift register? I think it's another concept.
// This is all thats running, randomness itself!
void main()
{
TRISB=0;TRISD=0;
char portbb=0xaa;
char portdd=0x3D;
while(1)
{
PORTB= portbb; portbb=~portbb;
PORTD= portdd; portdd+=3;
DelayS(1);
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?