Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed_shiftreg_2 by
Revision 8:6930a00ba8ba, committed 2017-01-04
- Comitter:
- akverma
- Date:
- Wed Jan 04 04:48:18 2017 +0000
- Parent:
- 7:2c0917fbf656
- Commit message:
- For test;
Changed in this revision
| shitreg.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2c0917fbf656 -r 6930a00ba8ba shitreg.cpp
--- a/shitreg.cpp Wed Jan 04 04:28:45 2017 +0000
+++ b/shitreg.cpp Wed Jan 04 04:48:18 2017 +0000
@@ -90,12 +90,13 @@
}
}
- void value_calculator()
+ void value_calculator(int flag)
{
for (int i=0; i<TOTAL_NODES; i++)
{
c3[i] = c1[i]^c2[i];
- C[i] = ~(c1[i]|c2[i]);
+ if (!flag) C[i] = ~(c1[i] | c2[i]);
+ else C[i] = ~(c1[i] & c2[i]);
}
for (int i=0; i<TOTAL_NODES; i++)
{
@@ -123,24 +124,28 @@
wait_ms(500);
cout<<"Starting: "<<endl;
wait_ms(500);
-
+ A[0]=0; A[1]=0; A[2]=1; A[3]=1; A[4]=0; A[5]=1; A[6]=0; A[7]=1;
+ B[0]=1; B[1]=0; B[2]=0; B[3]=1; B[4]=1; B[5]=1; B[6]=0; B[7]=1;
+ C[0]=1; C[1]=0; C[2]=1; C[3]=0; C[4]=0; C[5]=0; C[6]=1; C[7]=1;
for (int i=0; i<TOTAL_NODES; i++)
{
c1[i] = 0;
c2[i] = 1;
}
while(1){
- value_calculator();
+ //value_calculator(0);
shift();
shift_read1();
- value_calculator();
+ //value_calculator(1);
shift();
shift_read2();
time_counter1++;
- if (time_counter1 == 1000000)
+ if (time_counter1 == 10000)
{
- pc.printf("%X\n", 'B');
+ //pc.printf("c1[0]: %X\nc1[0]: %X\n", );
+ cout<<"C1::"<<c1[0]<<c1[1]<<c1[2]<<c1[3]<<c1[4]<<c1[5]<<c1[6]<<c1[7]<<endl;
+ cout<<"C2::"<<c2[0]<<c2[1]<<c2[2]<<c2[3]<<c2[4]<<c2[5]<<c2[6]<<c2[7]<<endl;
time_counter1 = 0;
}
}
