P
Pal
Guest
Čau,
Es jau dara host-to-KB kods.Vai jūs man?Kā mēs varam tests ourself?
Kods:
# include <reg51.h># define BYTE (7)
# define paritāte (1)
char D_Bus [BYTE paritāte] = (0);sbit clockpin = P3 ^ 2;
sbit datapin = P3 ^ 7;anulēts sendbit (char b) (
char i;
datapin = b;
for (i = 0; i <5; i ); / / Clock Laiks Hi
clockpin = 0;
for (i = 0; i <9; i ); / / Clock Laiks Lo
datapin = b;
clockpin = 1;
)anulēts D_Buffer (spēkā neesošs)
(
char nbit = 0, i = 0;darīt
(
clockpin = 1;
for (i = 0; i <5; i ) / / TCK - Clock Laiks Hi
(
D_Bus [nbit] = datapin;
)
clockpin = 0;
for (i = 0; i <9; i ) / / TCK - Clock Laiks Lo
(
D_Bus [nbit] = datapin;
)
) while (nbit <= 8);sendbit (1); / / HI
sendbit (0); / / ACK
)anulēts Host_To_Drive (spēkā neesošs) pārtraukt 0
(
char i = 0;while (! INT0);
datapin = 0;clockpin = 1; / / Raising Edge
for (i = 0; i <5; i ); / / TCK - Clock Laiks Hiclockpin = 0; / / Falling Edge
for (i = 0; i <2; i ); / / TCK - Clock Laiks LoD_Buffer ();
)anulēts main (spēkā neesošs) (IT0 = 0;
IE0 = 0;
EX0 = 1;
TF0 = 0;
EA = 1;while (1)
()
Es jau dara host-to-KB kods.Vai jūs man?Kā mēs varam tests ourself?
Kods:
# include <reg51.h># define BYTE (7)
# define paritāte (1)
char D_Bus [BYTE paritāte] = (0);sbit clockpin = P3 ^ 2;
sbit datapin = P3 ^ 7;anulēts sendbit (char b) (
char i;
datapin = b;
for (i = 0; i <5; i ); / / Clock Laiks Hi
clockpin = 0;
for (i = 0; i <9; i ); / / Clock Laiks Lo
datapin = b;
clockpin = 1;
)anulēts D_Buffer (spēkā neesošs)
(
char nbit = 0, i = 0;darīt
(
clockpin = 1;
for (i = 0; i <5; i ) / / TCK - Clock Laiks Hi
(
D_Bus [nbit] = datapin;
)
clockpin = 0;
for (i = 0; i <9; i ) / / TCK - Clock Laiks Lo
(
D_Bus [nbit] = datapin;
)
) while (nbit <= 8);sendbit (1); / / HI
sendbit (0); / / ACK
)anulēts Host_To_Drive (spēkā neesošs) pārtraukt 0
(
char i = 0;while (! INT0);
datapin = 0;clockpin = 1; / / Raising Edge
for (i = 0; i <5; i ); / / TCK - Clock Laiks Hiclockpin = 0; / / Falling Edge
for (i = 0; i <2; i ); / / TCK - Clock Laiks LoD_Buffer ();
)anulēts main (spēkā neesošs) (IT0 = 0;
IE0 = 0;
EX0 = 1;
TF0 = 0;
EA = 1;while (1)
()