Eric Nelson
Lifetime Supporting Member + Moderator
Since the last time I posted a 'weekend question', it got answered (thanks, AK!). I figured I'd try again THIS weekend...
I have used the following code in the past to send an ASCII string from an A-D DL06 PLC to a PacSci servo drive with great success... :nodi:
[attachment]
On the first rung, I convert the 'user units' (.001") to encoder counts. IOW, to move 2.500", the value 2500 is used. 2500 x 3306 / 100 = 82650 encoder counts, which is placed in V2022 and V2023 (0008 2650, or is it 2650 0008?).
The string that must be sent to the drive is:
<STX> 255 W 10093 = {my value} <CR>
For those who care, <STX> means "I'm sending you something", 255 is the drive axis (all), W means WRITE, 10093 is the move distance, and <CR> means "I'm done chatting"
So, if I want to move 82650 encoder counts, the string will be:
<STX> 255 W 10093 = 00082650 <CR>
The 'VPRINT' command on the second rung "Prints" this string to V-memory, starting at V3000. My (convoluted)
"$02" "255W10093=-" V2023:B V2022:B "$R"
successfully places the correct string in V-memory. "$02" is 'start of text' <STX>, and "$R" is the carriage return <CR>. The ":B" just prints my variables as BCD.
The last line simply sends this out the secondary COM port of the PLC, which the drive receives.
Notice that I have "Byte Swap" enabled in both print instructions. Why? I dunno. I wrote this a LONG time ago, and for some reason, that was the only way I could get it to work...
My problem is that on THIS machine I want the motor to turn in the opposite direction. Therefore, I need to send it a NEGATIVE number. The number will ALWAYS be negative, so it can in the text portion of the string.
All I need to do is add a "-" before the value, like this:
<STX> 255W10093 = -00082650 <CR>
By the way, the drive will ignore the spaces.
I have tried to finagle my string to produce a negative value, with no luck. The 'byte swap' **** has me thoroughly confused. I'm sure I didn't need the byte swap in the first place, but as I said, for some reason that's the only way I could get it to work...
Anyone wanna give it a shot?... utoh
A possibly easier solution would be to tell me how to reverse the motor electrically. I tried swapping two phases on the motor, plus inverting the Sine+ and Sine- connections from the resolver, but the drive didn't like that one bit! What's the CORRECT way?
Though I'd STILL like to know how to do it within my program.
beerchug
-Eric
I have used the following code in the past to send an ASCII string from an A-D DL06 PLC to a PacSci servo drive with great success... :nodi:
[attachment]
On the first rung, I convert the 'user units' (.001") to encoder counts. IOW, to move 2.500", the value 2500 is used. 2500 x 3306 / 100 = 82650 encoder counts, which is placed in V2022 and V2023 (0008 2650, or is it 2650 0008?).
The string that must be sent to the drive is:
<STX> 255 W 10093 = {my value} <CR>
For those who care, <STX> means "I'm sending you something", 255 is the drive axis (all), W means WRITE, 10093 is the move distance, and <CR> means "I'm done chatting"
So, if I want to move 82650 encoder counts, the string will be:
<STX> 255 W 10093 = 00082650 <CR>
The 'VPRINT' command on the second rung "Prints" this string to V-memory, starting at V3000. My (convoluted)
"$02" "255W10093=-" V2023:B V2022:B "$R"
successfully places the correct string in V-memory. "$02" is 'start of text' <STX>, and "$R" is the carriage return <CR>. The ":B" just prints my variables as BCD.
The last line simply sends this out the secondary COM port of the PLC, which the drive receives.
Notice that I have "Byte Swap" enabled in both print instructions. Why? I dunno. I wrote this a LONG time ago, and for some reason, that was the only way I could get it to work...
My problem is that on THIS machine I want the motor to turn in the opposite direction. Therefore, I need to send it a NEGATIVE number. The number will ALWAYS be negative, so it can in the text portion of the string.
All I need to do is add a "-" before the value, like this:
<STX> 255W10093 = -00082650 <CR>
By the way, the drive will ignore the spaces.
I have tried to finagle my string to produce a negative value, with no luck. The 'byte swap' **** has me thoroughly confused. I'm sure I didn't need the byte swap in the first place, but as I said, for some reason that's the only way I could get it to work...
Anyone wanna give it a shot?... utoh
A possibly easier solution would be to tell me how to reverse the motor electrically. I tried swapping two phases on the motor, plus inverting the Sine+ and Sine- connections from the resolver, but the drive didn't like that one bit! What's the CORRECT way?
Though I'd STILL like to know how to do it within my program.
beerchug
-Eric