#include <16f877a.h>
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG,NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use fast_io(b)
#use fast_io(d)
#use delay(clock=20000000)
int32 send_reg;
int8 m,l,x,lap;
int32 const chay[]={0x80000000,0x40000000,0x20000000,0x10000000,
0x08000000,0x04000000,0x02000000,0x01000000,0x0080 0000,0x00400000,0x00200000,0x00100000,0x00080000,0 x00040000,0x00020000,0x00010000,
0x00008000,0x00004000,0x00002000,0x00001000,0x0000 0800,0x00000400,0x00000200 ,0x00000100,
0x00000080,0x00000040,0x00000020,0x00000010,0x0000 0008,0x00000004,0x00000002,0x00000001};
int8 const data[]={255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,25 5,255,255,255,255,255,255,
247,176,182,190,193,
128,239,247,251,128,
224,215,183,215,224,
128,239,247,251,128,255,
128,
224,215,183,215,224,
191,191,128,191,191,255,
129,254,254,129,
185,182,182,206,255,
128,
190,221,235,128,
255,255,255,255,255,255,255,255,255,255,255,255,25 5,255,255255,255,255,255,255,255,255,255,255,255,2 55,255,255,255,255,255};
#bit d7=send_reg.31
void serout(){
int8 n;
for(n=0;n<32;n++)
{
output_low(pin_b0);
if(d7!=0) output_high(pin_b0);
output_low(pin_b1);
output_high(pin_b1);
send_reg=send_reg<<1;
}
}
void display(){
set_tris_b(0xf0);
output_low(pin_b2);
output_high(pin_b2);
serout();
output_low(pin_b3);
output_high(pin_b3);
}
void hc595(){
m=0;
for(m=0;m<32;m++){
x=m+l;
if(x<109){
send_reg=chay[m];
display();
output_d(data[x]);
delay_ms(2);
}
else {
send_reg=chay[m];
display();
output_d(data[x-109]);
delay_ms(2);
}
}
}
void main(){
set_tris_d(0);
output_d(255);
while(1){
l=0;
for(l=109;l>0;l--){
for(lap=0;lap<3;lap++)
{
hc595();
}
}
}
}
ở đây send_reg là gì vậy mọi người.
#bit d7=send_reg.31
void serout(){
int8 n;
for(n=0;n<32;n++)
{
output_low(pin_b0);
if(d7!=0) output_high(pin_b0);
output_low(pin_b1);
output_high(pin_b1);
send_reg=send_reg<<1;
}
vậy giá trị đầu tiên của send_reg là gi vậy mọi người.giúp em với đang cần gấp
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG,NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use fast_io(b)
#use fast_io(d)
#use delay(clock=20000000)
int32 send_reg;
int8 m,l,x,lap;
int32 const chay[]={0x80000000,0x40000000,0x20000000,0x10000000,
0x08000000,0x04000000,0x02000000,0x01000000,0x0080 0000,0x00400000,0x00200000,0x00100000,0x00080000,0 x00040000,0x00020000,0x00010000,
0x00008000,0x00004000,0x00002000,0x00001000,0x0000 0800,0x00000400,0x00000200 ,0x00000100,
0x00000080,0x00000040,0x00000020,0x00000010,0x0000 0008,0x00000004,0x00000002,0x00000001};
int8 const data[]={255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,25 5,255,255,255,255,255,255,
247,176,182,190,193,
128,239,247,251,128,
224,215,183,215,224,
128,239,247,251,128,255,
128,
224,215,183,215,224,
191,191,128,191,191,255,
129,254,254,129,
185,182,182,206,255,
128,
190,221,235,128,
255,255,255,255,255,255,255,255,255,255,255,255,25 5,255,255255,255,255,255,255,255,255,255,255,255,2 55,255,255,255,255,255};
#bit d7=send_reg.31
void serout(){
int8 n;
for(n=0;n<32;n++)
{
output_low(pin_b0);
if(d7!=0) output_high(pin_b0);
output_low(pin_b1);
output_high(pin_b1);
send_reg=send_reg<<1;
}
}
void display(){
set_tris_b(0xf0);
output_low(pin_b2);
output_high(pin_b2);
serout();
output_low(pin_b3);
output_high(pin_b3);
}
void hc595(){
m=0;
for(m=0;m<32;m++){
x=m+l;
if(x<109){
send_reg=chay[m];
display();
output_d(data[x]);
delay_ms(2);
}
else {
send_reg=chay[m];
display();
output_d(data[x-109]);
delay_ms(2);
}
}
}
void main(){
set_tris_d(0);
output_d(255);
while(1){
l=0;
for(l=109;l>0;l--){
for(lap=0;lap<3;lap++)
{
hc595();
}
}
}
}
ở đây send_reg là gì vậy mọi người.
#bit d7=send_reg.31
void serout(){
int8 n;
for(n=0;n<32;n++)
{
output_low(pin_b0);
if(d7!=0) output_high(pin_b0);
output_low(pin_b1);
output_high(pin_b1);
send_reg=send_reg<<1;
}
vậy giá trị đầu tiên của send_reg là gi vậy mọi người.giúp em với đang cần gấp