LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in the Stepper Motor Run.

Solved!
Go to solution

Dear Frriends,

 

I am working on stepper motor. I am not sure, How can I check its response with my lab view program. 

I designed the basic program but I wasn't able to get any response. 

 

Written Command: It was to Accelerate the motor up to 25.

Serial Bus: RS232

DAQ: NI PXIe-1078

Error: 

Version 1":

skdubey_0-1612549264256.png

 

I try to fix the problem using the solution but couldn't able to (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019L3mSAE&l=en-CA). Main thing, I didnt seen any indication or any motion of motor was observed. 

 

Version 2":

 

skdubey_1-1612550148213.png

 

I try to get use  byte at port the rationale behind is that I thought the connection to host and my pc may be of terminal type. -

I checked online and it says that this is not an error message, but a status report indicating the value written to the input buffer has been successfully read and is now empty.  I am not sure what the problem is. 
 
In both the case neither i saw the response or motion of motor any suggestion, I am using DC Stepper motor. 
 

 

 

 

0 Kudos
Message 1 of 11
(3,658 Views)

99.9% of the time, Bytes at Port is the wrong thing to use.

 

If you do use it, then you want a delay between the write and the Bytes at Port to give the instrument time to read the message, act on it, and write back a response.  (Are you even sure it sends back a response?  Good protocol design would dictate that, but there is no guarantees whoever wrote the serial code in the instrument did that.)

 

One thing I do find odd between your two versions is that in version #1, you are talking to Com 1.    In version #2, you are talking to Com8.

 

Make sure you read the manual for this device.

 

Also, recently Crozzrulz did a VI Week presentation do help people understand good serial communication practices and distance them from some of the bad concepts NI has in their serial communication examples.  I recommend looking at that.

 

 

0 Kudos
Message 2 of 11
(3,653 Views)

Dear Friends, 

 

I am using the DC stepper motor along with the encoder to run some application.

In my LabVIEW design, I am not receiving data or response for any of my command from the host stepper motor. I am not sure what is my mistake.  I have only use port byte to see if there is any data send to my device. It show no data in return to response. 

My goal is to set the motion of the stepper motor. I am not sure what to do? next?

 

Written Command: It was to Accelerate the motor up to 25.

Serial Bus: RS232

DAQ: NI PXIe-1078

Written Command: ASCII ( https://appliedmotion.s3.amazonaws.com/Host-Command-Reference_920-0002V.pdf)

Issue: 

Version 1": (False Structure)

 

Questions:

 

A. if there is no communication send back from the device,

Did I have any mistake in my LabVIEW Program, such as incorrect design or sequence. ??

 

B. How  can I try to get the response back from the device, in case if it is not responding to the communication port. 

This is manual I am using : https://appliedmotion.s3.amazonaws.com/Host-Command-Reference_920-0002V.pdf

 

 

B. False Structure (Result)

 

 
 

 

A. True Structure

3.png

 

 

 

 

0 Kudos
Message 3 of 11
(3,586 Views)

Thanks,

 

I refer that video it was really helpful to me understand the mechanism.

Thanks., But I still couldn't able to communicate with the device, I use port byte to know if there is any data to read. There is nothing. I am not sure what to do next.?

0 Kudos
Message 4 of 11
(3,568 Views)

That latest picture doesn't make any sense at all.

 

You initialize the serial port, then check bytes at port.  Why would there be bytes at port, because you haven't told it to do anything, it is not going to respond.  (Perhaps you did something in the B False structure that is perhaps missing a picture?  Why does B come before A?

 

In the picture, you try to read from the device before you write to the device.  Again there will be nothing to read, assuming the code is ever able to get into that case.

 

That is too big of a manual for me to go digging into.  Are you sure you don't need to send some other commands to configure the stepper motor first?

Are you sure you have the correct cable and all your serial port parameters are correct?

Have you tried to run the stepper motor with any software that the manufacturer provides?  That would at least tell you that the cable is correct and the stepper motor is paying some attention to the serial port.

 

The VISA open is not necessary.  The VISA configure serial port already opens the port.  Be sure to clean up your block diagram to get rid of the extra wire bends making a picture hard to follow.  And attach the VI so we can poke at it and see the hidden cases in the structure.

 

In your last picture you have a VISA Write of AM2000, but no indication you are ending it with a carriage return character.  According to the manual, AM is acceleration MAX, basically a configuration setting.  Not the kind of thing that tells a drive to start moving.  AC is an acceleration rate. 

0 Kudos
Message 5 of 11
(3,556 Views)

Dear Ravens,

 

a. I think you share the video initially with me, In that instructor try to communicate in similar way with the device. He is using to read the data from the angular encoder. I think its quite similar to mine since I have encoder with my stepper motor. This is the basis of my LabVIEW program.

Anyway, as you said, I need to provide the instruction in order to get the response, I have explain that too in the following section. 

skdubey_0-1612997796598.png

 

B. B before came A, its just Typo error and Comm port number is different that why because, I thought may be comm port are mulfunctioning.

 

C. There is configuration command for tuning the Step motor drive, but when I was reading the manual they told to try with the "We recommend practicing with SCL commands with no load attached to the motor shaft. You want the motor shaft to spin freely during startup to avoid damaging mechanical components in your system. AC25 Set accel rate to 25 rev/sec/sec." I thought, this gonna be good start command to work initially  with the motor hence I started directly using this command.

 

D. I tried again with the old version. As you can see my old post of same issue.

Version 1: Error: (1073807339) : Its time out error, I only try to resolve the problem using wait time (100ms)

Version 2: Error : (1073676294) : Error mean  The Number of Bytes Transferred is Equal to the Input Count.  More data might be available. I didn't understand this so well. May be I am providing the wrong byte., generally I give you around 4096 maximum. I try to resolve this issue by connecting the byte size from the property node to the read (byte size) as follow

Version 3: As follow Also while resolving the earlier model issue, I provided the time delay (50ms) to read port in order to use port a byte properly.

Irrespective of my effort, I am still getting the same error. 

 
 

I am trying to read again the manual and trying to find properly. thanks, 

Please let me know your suggestion. 

 

 

 

 

 

 

 

0 Kudos
Message 6 of 11
(3,548 Views)

@skdubey wrote:

 

Version 2: Error : (1073676294) : Error mean  The Number of Bytes Transferred is Equal to the Input Count.  More data might be available. I didn't understand this so well. May be I am providing the wrong byte., generally I give you around 4096 maximum. I try to resolve this issue by connecting the byte size from the property node to the read (byte size) as follow

 


Actually that is not an error, but a warning.  (One that I think is actually stupid for LabVIEW to provide.)  It means that the serial port was able to provide the bytes that you asked for.  If you used Byte at Port, and it returned 0, and you do a VISA Read on those 0 bytes, you asked for nothing, will get nothing, and will get this nice "warning" that there is a chance that other bytes are still in the serial buffer.  (Guess what, there is always a chance there are more bytes in the buffer.!)

 

Using Bytes at Port doesn't fix it.

 

The best solution is to use a termination character and ask for more than you expect.  If you ever do get this warning message, you can safely ignore it.

 

One thing that is strange in your VI is the string control called "Extra" which by default is blank that you concatenate on the command.  Can I assume that you are trying to put a termination character in there?  I remember reading that your comms require a carriage return as a communication character.  Just put a string constant make the display style visibile and set it for \code display.  Type in AC\r  (or whatever command you want).  It will send an AC and carriage return without needing all the extra nodes.  And your constant is set to display that to make it obvious what you are doing when you look at it.

 

I also thought I read that you response back is similar to the command.  So it also ends in a carriage return.  You are not taking advantage of that now.  Your VISA serial configure is pretty default.  It defaults to Termination Character enabled, but a termination character of line feed.  Right click on the character input on the top, and change it from 10 (line feed) to 13 (carriage return).  With the wrong one, you'll get a full response but it will timeout waiting for a linefeed that never comes.  With the right setting, you'll get a full message and it will return without error as soon as it gets the CR.

 

For the VI you just attached, this modification I attached should work better.

 

0 Kudos
Message 7 of 11
(3,543 Views)

Thanks Raven for your feedback,

 

I just still couldn't able to run your program. I am not sure why it is showing me the Error: 1073807339. Its

same error for time out.

 

Solution 1: I tried using the wait command 100ms still this error didn't resolve, I tried with higher waiting time like upto 5000ms..nothing work. 

 

Solution 2: I chose the new com port for the error, that is com 7 and 

 I decided to follow test panel and look if the termination method for that com port is enabled or not. After enabling it, I am still got the error, I look back again the visa test panel it show something like this. 

5.png

I saw same error for com port earlier to 1 and it has same issue.

My connection look something like this. 

 

6.png

 

I have tried using the reading commands like BS and it still it didn't respond. Basic Command structure must be "YXXAB<cr>" . I use the command like AC25 still no response or I at least I am excepting "Nack". 

 

7.png

 

0 Kudos
Message 8 of 11
(3,512 Views)

You've got at least 3 different things going on here.

 

In your top picture., those yellow question marks look like the kind of thing you'd see if the serial port had some kind of driver issue.  Go into Windows Device Manager and see if what the serial port shows up like under there.

 

The dialog in that top picture is what you'd see if something else has the serial port open.  Did you leave another program open?  Make sure you close MAX when you are running your VI.  Make sure your VI is stopped, perhaps go ahead and close LabVIEW, if you are testing things in MAX.

 

In your bottom picture, you are not going to see an error there due to the rules of data flow.  Your block diagram shows the stop button is false, and the while loop is still running.  That error won't leave the while loop and get to the error indicator until you hit the stop button.  Put an error indicator on the wire inside the loop if you want to see the error while its running.

 

I see you have highlight execution turned on.  Has it been on the whole time, or just for you to take that picture?  Highlight execution intentionally slows down the execution of the code.  So things that depend on timing, such as serial communication, could be affected.

 

Your string constant for the command is not the same as what I gave you.  Did you change it?  Go back and look at my VI again.  Notice I have AC25\r, you don't have the \r.   It is important.  It is the \code for a carriage return which your device is expecting at the end of the command.  Without it, your device is probably waiting for you to tell it more information and is not going to do any action and return a response until you do.

Message 9 of 11
(3,502 Views)

Hi Raven,

 

I checked the driver and found it was showing its already updated. I am not sure what is the issue the comm port cable.

 

Anyway I tried to connect the CABLE to directly to the port of the Deck, and yes it working, its responding to all my communication command (Buffer status, Baud Rate, Protocol etc.). I tried the motion command directly like ( AC25\r) still no responses. I am not sure, how can I test that. 

 

I am not an electronic guys, I just would like to ask simple question.

A. Once we run the communication command, do we need to configure the motor before running, like setting up some set of command to do. 

B. Do I need to care for anything or create another LabVIEW program to control the motion.?

C. Any tips for beginner when they are creating such LabVIEW program. ?

 

thanks for all the suggestion!

 

 

0 Kudos
Message 10 of 11
(3,482 Views)