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 new_slave by
Revision 1:541e44bb5f9b, committed 2015-01-22
- Comitter:
- sakthipriya
- Date:
- Thu Jan 22 14:37:23 2015 +0000
- Parent:
- 0:e2acb437847f
- Commit message:
- slave debug
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jan 20 17:57:59 2015 +0000 +++ b/main.cpp Thu Jan 22 14:37:23 2015 +0000 @@ -16,8 +16,8 @@ { slave.address(0x20); - while(ack0==1) - { + while(ack0) + { if(slave.receive()==1) { ack0=slave.write(&writedata,1); @@ -26,27 +26,21 @@ } else if(slave.receive()==3 || slave.receive()==2) { - ack1=slave.read(&readdata,1); + ack0=slave.read(&readdata,1); } + printf("loop"); } - if(!ack0 ) - { - printf("slave has written %c to slave\n\r",writedata); - //printf("\n \r %d %d %d %d %d\n",*data_reg,*status_reg,*c1_reg,*c2_reg,*freq_reg); - } + // if(!ack0 ) + //{ + printf("\ndata writen %d\n\r",writedata); + printf("\n\r data read %d \n",readdata); + //printf("\n \r %d %d %d %d %d\n",*data_reg,*status_reg,*c1_reg,*c2_reg,*freq_reg); + /* } else { printf("\n\r data not written to slave \n"); - } - if(!ack1 ) - { - printf("slave has read %c to master \n \r",writedata); - //printf("\n \r %d %d %d %d %d\n",*data_reg,*status_reg,*c1_reg,*c2_reg,*freq_reg); - } - else - { - printf("\n\r data not read from master \n"); - } + }*/ + } @@ -64,7 +58,7 @@ int main() { printf("\n slave started\n\r"); - + slave_intrpt = 0; master_intrpt.rise(&FUNC_INT); while(1) {