RS-485 C Language Example Program for RK2

Discuss Stepper motors, Drivers, Controllers, GUI's and related Accessories here.
finamacabc
Posts: 2
Joined: Tue Oct 21, 2014 9:21 am

RS-485 C Language Example Program for RK2

Postby finamacabc » Mon Dec 01, 2014 8:56 am

Hi,
I am looking for an example in C language (or any other language) to perform simple actions on the RKSD507-CD driver using RS-485 protocol.
I am not using the Mexe02 program. In the future, I am planning use a microcontroller to handle this driver, via RS-485 standard.
I just want to send the correct package bytes to an one driver and one motor to perform a single step forward, backward, increase/decrease the speed, home function, etc, in RS-485.
Best Regards,
Cesar

User avatar
om_tech_support_JT
Posts: 1058
Joined: Fri Mar 12, 2010 2:59 pm
Location: Torrance, CA
Contact:

Re: RS-485 C Language Example Program for RK2

Postby om_tech_support_JT » Tue Dec 02, 2014 12:06 pm

Hi Cesar,

Sorry Oriental Motor does not support C. This product was designed to communicate with a Modbus RTU via RS-485 so we only support Modbus. If you can find a C/Modbus library file, it would make this easier. Hopefully someone else can offer some insight.

An alternative would be to use a microcontroller that can communicate via C and just have it send pulses to our driver. It's just 4 extra wires. You would have to use the pulse input driver model, RKSD507-C.

finamacabc
Posts: 2
Joined: Tue Oct 21, 2014 9:21 am

Re: RS-485 C Language Example Program for RK2

Postby finamacabc » Fri Dec 05, 2014 10:43 am

Hi,
Thanks for your reply .
I am looking for a microcontroller code that handle the basic operations of the RKSD507 - C to perform a single step forward, backward , increase / decrease the speed , home function , etc.
Specifically , i am looking for the hexadecimal values ​​to perform these basic operations.
How the Mexe02 in teachinng mode operates ? I just want to replicates these basic functionalities in a microcontroller or in a computer.
I think that in the source codes of the Mexe02 program you will found these hexadecimal values.
I have configured 1 motor and 1 controller with ID=01
Best Regards
Cesar

User avatar
om_tech_support_JT
Posts: 1058
Joined: Fri Mar 12, 2010 2:59 pm
Location: Torrance, CA
Contact:

Re: RS-485 C Language Example Program for RK2

Postby om_tech_support_JT » Wed Dec 17, 2014 12:26 pm

Hi Cesar,

We do not support C. I would suggest that you figure out the Modbus hexadecimal commands first, then integrate it into C. You will have to read and write to multiple data register addresses in order to do what you want. There's a register for every possible parameter such as starting speed, running speed, positioning distance, dwell time....etc. At this moment, we do not provide example codes other than our user manual. Once you have programmed everything, you would use the 007Dh inputs register to toggle inputs on/off remotely from your microcontroller.

MANUAL (MODBUS RTU SECTION BEGINS ON PAGE 117:
http://www.orientalmotor.com/products/p ... 085-2E.pdf
-PAGE 132 - writing to registers.
-PAGE 135 - list of register addresses.

We would also suggest that you download a terminal software called ComTest Pro in order to test out your Modbus hexadecimal commands. Once everything works in Modbus, then it would be easier to integrate C.

Here are additional posts that may help:

COMTEST PRO GUIDE:
viewtopic.php?f=18&t=916

GENERAL INTRO ON MODBUS COMMUNICATION ON FLEX PRODUCTS:
viewtopic.php?f=26&t=716

AjayDevgan
Posts: 1
Joined: Fri Mar 10, 2017 12:39 am

Re: RS-485 C Language Example Program for RK2

Postby AjayDevgan » Fri Mar 10, 2017 12:39 am

C was initially created by Dennis Ritchie in the vicinity of 1969 and 1973 at Bell Labs and used to re-actualize the Unix working framework. It has since turned out to be a standout amongst the most broadly utilized programming dialects ever with C compilers from different merchants accessible for the lion's share of existing PC structures and working frameworks. c programming pdf C has been institutionalized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and consequently by the International Organization for Standardization (ISO).

Notwithstanding its low-level abilities, the dialect was intended to support cross-stage programming. A norms consistent and movably composed C program can be accumulated for a wide assortment of PC stages and working frameworks with few changes to its source code. The dialect has turned out to be accessible on an extensive variety of stages, from implanted microcontrollers to supercomputers. Unix was one of the principal working framework portions actualized in a dialect other than gathering. Prior occasions incorporate the Multics framework which was composed in and Master Control Program for the Burroughs B5000 written in ALGOL in 1961. In around 1977, Ritchie and Stephen C. Johnson rolled out further improvements to the dialect to encourage conveyability of the Unix working framework. Johnson's Portable C Compiler filled in as the reason for a few usage of C on new stages.


Return to “Stepper Motors and Controls”

Who is online

Users browsing this forum: No registered users and 7 guests