1.Combine library into this project 2.Use this to do the complete fuction
Dependencies: DXL_SDK_For_F446RE Matrix Modbus_For_F446RE RobotControl_7Axis mbed
Diff: main.cpp
- Revision:
- 1:249f89a36223
- Parent:
- 0:f147c77caac0
- Child:
- 4:8fc956bd0e78
diff -r f147c77caac0 -r 249f89a36223 main.cpp --- a/main.cpp Fri Mar 31 02:08:44 2017 +0000 +++ b/main.cpp Fri Mar 31 10:39:39 2017 +0800 @@ -88,6 +88,24 @@ static USHORT usRegHoldingBuf[REG_HOLDING_NREGS]; /* ----------------------- Start implementation -----------------------------*/ +Ticker tMobusPoll; + +void fMobusPoll() +{ + //(void)eMBPoll( ); origianl + // + eMBPoll(); + + /* Here we simply count the number of poll cycles. */ + usRegHoldingBuf[DEF_INX_TARGET_POSX]++; + + if(usRegHoldingBuf[DEF_INX_TARGET_POSX]==200)//stanley + { + myled=!myled; + usRegHoldingBuf[DEF_INX_TARGET_POSX]=0; + } +} + int main( void ) { @@ -99,6 +117,8 @@ eMBEnable( ); //eStatus = eMBEnable( ); + + // Initialise some registers // usRegInputBuf[1] = 0x1234; // usRegInputBuf[2] = 0x5678; @@ -125,25 +145,11 @@ } - + tMobusPoll.attach_us(&fMobusPoll,10000); myled=1;//stanley - for( ;; ) - { - //(void)eMBPoll( ); origianl - // - eStatus=eMBPoll(); - - /* Here we simply count the number of poll cycles. */ - usRegHoldingBuf[DEF_INX_TARGET_POSX]++; - - wait_ms(5); //stanley - if(usRegHoldingBuf[DEF_INX_TARGET_POSX]==200)//stanley - { - myled=!myled; - usRegHoldingBuf[DEF_INX_TARGET_POSX]=0; - } - } + while(1); + } eMBErrorCode