01-25-2017 01:50 PM
Thank you WMN! I was actually able to get the 9870 to work in scan mode and drive the motor using SCL commands. And yes I have been playing with that FPGA example and can send/receive commands to the motor. However as a response I am only getting ack/nak (0?1). I did however deterimine the motor I am using does ASCII commands using a COM monitor. I found that FL2000. = 46 4c 32 30 30 30 0d with a motor response 0%. = 30 25 0d when connected to my PC. Do you have any recommendations on how to modify the example code in order to send these stardards?
01-25-2017 03:19 PM
The accompanying text with that example says "This code can also run loopback tests, as is, with the appropriate wiring* in place." Have you done that and were you successful?
* jumper the transmit and receive pins together on your S8 cable.
01-26-2017 11:05 AM
Yes, whatever command I enter into the write to string appears in Port1. However, when I enter the SCL commands when connected to the motor I only receive 0?1 for whatever command I am entering
01-26-2017 11:16 AM
If what you send is what you get in the loopback case, then the software to send and receive is working and the 9870 module is able to communicate with itself using its current settings, whatever those might be.
If on the other hand, when you send a command to the motor and it responds back with "Huh?", that says to me that you have not not yet gotten the 9870 correctly configured in the project to produce intelligible RS-232 communications using the settings that the motor expects to be used. The fact that the 9870 was able to communicate with the motor properly using the scan interface tells us that the 9870 can be configured properly.
So, since you seem to want to use the FPGA interface (rather than scan interface) one of the penalties you must pay for that choice is that it is now on you to figure out how to manually configure the 9870's communication parameters in the project so that it works with the field device. Right-click on it, select properties and start trying things.
01-26-2017 04:33 PM
When I right click on the 9870, I only get the option to change the baud rate and other serial port parameters. However I know these are correct because I they are taken from the motor's manual. Is there some other properties you are refering too.
Also I did find out that the FPGA RS232 example file converts my string data (ie. FL2000 to 70,76,50,48,48,48) before sending to fifo write, and using scan mode (with visa write), FL2000 is inputed directly.
01-26-2017 05:33 PM
@JonSoucy wrote:
When I right click on the 9870, I only get the option to change the baud rate and other serial port parameters. However I know these are correct because I they are taken from the motor's manual. Is there some other properties you are referring too.
Those (baud rate, parity, data bits, stop bits, flow control) are the settings to which I was referring. I also remembered seeing a divider and prescalar value but now that I look back at the properties panel I see that those are not settings you can change here.
Yor first screen shot shows the use of a VISA call. Know that you can only use VISA with a scan-mode FPGA. You cannot use VISA calls for 9870 communications if the cRIO is not in scan mode.
Your second screen shot would seem to indicate that you are passing a byte array to a "write FIFO" method and expecting the entire array to be sent. This may work but it is not something I've done. Both in the example I pointed you to on the NI website and the example I built from code working here and sent as an attachment, the byte data array feeds a loop where each byte is individually pulled from the array and then sent as a single byte using a "write byte" method.
01-26-2017 05:43 PM
Are those values the ones you recommend trying to change?
I like the idea of using that write byte method, however, I do not know what string of bytes need to be sent in as a command for the motor. Is there a way to figure this out? Could I read what bytes are being sent through the serial port in scan mode and reverse engineering that to use similar logic in the fpga?
01-26-2017 05:49 PM
Just make sure the baud rate, parity, data bits, stop bits and flow control settings are correct.
In the cRIO/RT part of the system, you need to assemble the ASCII string complete with terminating character (like you have been doing) and pass it it through the LabVIEW string-to-byte-array function. Pass that array from the RT system to the FPGA (a non-trivial task itself) and let the FPGA shuffle the bytes out the port.
01-27-2017 04:54 PM
Thank you everyone for all your help. The issue with the example code is each command was terminated by a "\" by default. I replaced this with Carriage Return or with a 13 appended to the byte array. The only issue I am having now is running the host vi off the cRIO vs on my PC.