Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

How to send hex string to contral a digital servo motor by CR1000 via RS232


Kony Feb 8, 2021 02:51 AM

 Did anyanye try CR1000 to control other instrument by send Hex string?

I need to contral a digital servo motor with folling string to make it turn to a specific position(angle),eg.
Send Hexstring :"FF FF 01 0A 03 29 32 00 00 00 00 5F 00 37 " to make it back to home point and Hexstring :"FF FF 01 0A 03 29 32 00 08 00 00 5F 00 2F " for half turn to run,etc


JDavis Feb 9, 2021 09:19 AM

You need to either load the data into an array of longs or a string.

Then use SerialOutBlock to send it out.

Be sure to NOT use format 0 in SerialOpen.

 

Public SendCommand As Boolean

'Note that the last Long has extra nulls added to the end. Each long is 4 bytes
Dim Position1(4) As Long = {&hFFFF010A, &h03293200, &h0000005F, &h00370000}



'Main Program
BeginProg

  SerialOpen (Com1,9600,3,0,50)

  Scan (1,Sec,0,0)

    If SendCommand Then
      SerialOutBlock (Com1,Position1(),14)
      SendCommand = false
    EndIf

  NextScan
EndProg

 


Kony Feb 12, 2021 08:50 AM

Many thanks for your help! I am still working on it.

Log in or register to post/reply in the forum.