Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 void sendserial(unsigned char gireesh) { unsigned char gk; for (gk = 0x80; gk; gk >>= 1) { if (gireesh & gk) { P3_2 = 1; // Data delay(1); } else { P3_2 = 0; // Data delay(1); } P3_0 = 1; // SH_CP P3_0 = 0; } }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 void sendserial(unsigned char); unsigned char a[] = { 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70 }; unsigned int i, j, l, k, temp; unsigned int k = 8; void main() { P0 = 0x00; P3 = 0x00; while (1) { for (i = 0; i < 8; i++) { temp = ~a[i]; sendserial(temp); for (l = 0; l < 10; l++) { P2 = (1 << i); } P3_1 = 1; // ST_CP P3_1 = 0; } void sendserial(unsigned char gireesh) { unsigned char gk; for (gk = 0x80; gk; gk >>= 1) { P3_0 = 1; // SH_CP P3_0 = 0; if (gireesh & gk) { P3_2 = 1; // Data delay(1); } else { P3_2 = 0; // Data delay(1); } } }
Set STCP=0 is it means initilisation ?
Set SHCP=0 '' ''
void sendserial(unsigned char);
unsigned char a[]= { 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70 };
unsigned int i ,j,l,k,temp;
unsigned int k =8;
void main()
{
P0 = 0x00;
P3 = 0x00;
while(1)
{
P3_0 = 0; // SH_CP intilization
P3_1 = 0; // ST_CP Intilization
// for(i=0; i<8; i++)
{
[B][COLOR="#FF0000"] //temp = ~a[i];[/COLOR][/B]
[B][COLOR="#0000FF"]temp=0x0f;[/COLOR][/B]
sendserial(temp);
P3_1 = 1; // ST_CP
P3_1 = 0;
[B][COLOR="#0000FF"]P2=0xff;[/COLOR][/B]
[B][COLOR="#FF0000"] /* for(l=0; l<10; l++)
{
P2 =(1<<i);
} */[/COLOR][/B]
}
}
}
void sendserial(unsigned char gireesh)
{
unsigned char gk;
for (gk = 0x80; gk; gk>>=1)
{
if (gireesh&gk)
{
P3_2 = 1; // Data
delay(1);
}
else
{
P3_2 = 0; // Data
delay(1);
}
P3_0 = 1; // SH_CP
P3_0 =0;
}
}
how can i shift the data to the next position
shift the data through the next bit address
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?