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.
Dependencies: EthernetNetIf mbed
Revision 3:d7d7c67f21fa, committed 2012-03-15
- Comitter:
- paleskyjp
- Date:
- Thu Mar 15 15:28:14 2012 +0000
- Parent:
- 2:53de07fd9705
- Commit message:
- eMBRegCoilsCB was corrected.
(Implementation of writing single coil was wrong.)
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Mar 13 13:16:24 2012 +0000
+++ b/main.cpp Thu Mar 15 15:28:14 2012 +0000
@@ -127,13 +127,13 @@
#if MB_TCP_ENABLED == 1
Net::poll();
#endif
-/*
+
if(tm.read()>.5)
{
led1=!led1; //Show that we are alive
tm.start();
}
-*/
+
eStatus = eMBPoll( );
/* Here we simply count the number of poll cycles. */
@@ -249,11 +249,9 @@
case MB_REG_WRITE:
// Write coils
- if(iIntBitNum==0){
- usRegCoilBuf[iIntBufNum]=0;
- }
- ucTemp=(pucRegBuffer[iExtBufNum]>>iExtBitNum) & 1;
- usRegCoilBuf[iIntBufNum]|=ucTemp<<iIntBitNum;
+ ucTemp=usRegCoilBuf[iIntBufNum]&(~(1<<iIntBitNum));
+ ucTemp|=((pucRegBuffer[iExtBufNum]>>iExtBitNum) & 1)<<iIntBitNum;
+ usRegCoilBuf[iIntBufNum]=ucTemp;
break;
}
iIntRegIndex++;