Hi, i need a little help here with sending to a COM port.
I use martins UDF for a servo controller and a servo, i have connected and received version from the controller by using _CommSetPort, _CommSendString, _CommGetString.
So there is no problem communicating with it, however i want to move the servo now but i have no idea what to send it.
I have tried this but it doesnt move at all.
$Starting = "!SC"
$Cpara = "15" ;servo is on spot 15 on the controller
$Rpara = "7" ;movement speed set to 7
$Lowbyte = "1011"
$Highbyte = "1011"
_CommSendString($Starting & $Cpara & $Rpara & $Lowbyte & $Highbyte & @CR, 1)
Sleep(500)
FileWriteLine($file, "" &_NowTime() &"Servo position moved to " & $Lowbyte)
Here is some info from the manual. Syntax: !SC C R pw.LOWBYTE, pw.HIGHBYTE, $0D
CODESyntax: !SC C R pw.LOWBYTE, pw.HIGHBYTE, $0D
Reply: none
To control a servo, you must write a position command to the PSC. Each position command is comprised
of a header, three parameters: C, R, and PW, and a command terminator.
The Header: !SC is the header. The header signifies to all devices on the same wire that this is a
command for a Servo Controller.
The C parameter is a binary number 0-31 corresponding to the servo channel number. The servo
channel number should be 0-15
The R parameter is a binary number 0 63 that controls the ramp function for each channel. If the ramp
parameter is set to 0, ramping is disabled and the pulse width will be set to the P parameter sent
immediately. Ramp values of 1-63 correspond to speeds from ¾ of a second up to 60 seconds for a full
500 μs to 2.50 ms excursion for standard servos. This correlation is rather linear though no equation
presently exists.
The P parameter is a 16-bit Word that corresponds to the desired servo position. The range, (250-1250),
corresponds to 0 to 180 degrees of servo rotation with each step equaling 2 μs.
The command terminator, $0D, (CR), must not be omitted.