''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' MD03 Example Test Routine ' This program sets up and initialises an oI2C object called MD03 ' It then goes into an endless loop, accelerating the motor to maximum ' forward speed, then decellerating it through zero to a slow reverse speed. ' It uses address 0xB0, which can be changed with the following; ' MD03.Node = 88 'Decimal of Hex address 0xB0 shifted right by 1 ' MD03.Node = 89 'Decimal of Hex address 0xB2 shifted right by 1 ' MD03.Node = 90 'Decimal of Hex address 0xB4 shifted right by 1 ' MD03.Node = 91 'Decimal of Hex address 0xB6 shifted right by 1 ' MD03.Node = 92 'Decimal of Hex address 0xB8 shifted right by 1 ' MD03.Node = 93 'Decimal of Hex address 0xBA shifted right by 1 ' MD03.Node = 94 'Decimal of Hex address 0xBC shifted right by 1 ' MD03.Node = 95 'Decimal of Hex address 0xBE shifted right by 1 ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim MD03 As New oI2C 'Create the MD03 object Dim Status As New oByte 'Hold status reg from MD03 Sub main() 'Start of main program MD03.Node = 88 'Decimal of Hex address 0xB0 shifted right by 1 MD03.Mode = cv10bit 'I2C mode is 10-Bit Addressing. MD03.NoInc = 1 'Don't increment MD03.Location = 3 'Address of accel reg MD03 = 254 'Gentle acceleration While(1) MD03.Location = 2 'Address of speed reg MD03 = 243 'Fast speed MD03.Location = 0 'Address of command reg MD03 = 1 'Run motor forwards Do MD03.Location = 1 'Address of status reg Status = MD03 Status = Status And 1 'Onlt bit 0 is required Loop While(Status = 1) 'Wait for Acceleration to complete MD03.Location = 2 'Address of speed reg MD03 = 30 'Slow speed MD03.Location = 0 'Address of command reg MD03 = 2 'Run motor backwards Do MD03.Location = 1 'Address of status reg Status = MD03 Status = Status And 1 'Onlt bit 0 is required Loop While(Status = 1) 'Wait for Acceleration to complete Wend End Sub