CamEra Posted November 8, 2009 Share Posted November 8, 2009 Hi, A few months ago you helped me with working how to talk to a modbus instrument - an SEW Modbus gateway to control motor speed. Just got back to lookling at this and have a small problem. The code we used was device.Movitrac.SetRegisterS16(255,4,{518,10928,2730}) the first address is 4 and the three values are - 518 turns the motor on and the second value (10928) sets the speed with 16384 being equal to maximum speed which can be set to the actual max speed of the mote , in this case 1500 rpm so the 10928 is 1000 rpm, the third does not matter. The above code works but I want to be able to vary the motor speed by changing a variable which is then sent to the controller e.g. to set it at 900 rpm the calculation speed = 900/1500 * 16384 which would put speed = 9830 would be done and then the code would read device.Movitrac.SetRegisterS16(255,4,{518,speed,2730}) this doesn't work, gives me an error C1000 Channel or function not found: MyStart Line 3 - Uncaught error in sequence MyStart Any ideas? Thanks George Link to comment Share on other sites More sharing options...
AzeoTech Posted November 9, 2009 Share Posted November 9, 2009 You can't put anything but constants inside of {} notation. What you need to do is use a variable for all three values. Something like this: global myVar = {518,10928, 2730} (use a better name than myVar) then to write: device.Movitrac.SetRegisterS16(255,4,myVar) Now to change the second number, you just do: myVar[1] = 9830 and call the device.movitrac..... code again Link to comment Share on other sites More sharing options...
CamEra Posted November 9, 2009 Author Share Posted November 9, 2009 Typically, I figured it would be simple, I look forward to trying it tomorrow. As always very quick service and * very clear answer. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.