velocity setting on maxon motors EPOS 24/5

Hello, I want to use an arduino UNO to set the velocity at my EPOS 24/5 with the rs232. Has someone some experience with this positioning controller and can send me an example sketch or just a tip. The problem is, that ich don't know how to send and read the datas with the rs232. I tried all Serial.write() an .read stuff with no result. The only thing I 've got is the crc16 ccitt calculation.

How do i translate this(example written in Windows Visual) to use it for arduino:

aus SerialCtrl.h

BOOL SerialCtrl::Read(char * inputData, const unsigned int & sizeBuffer, unsigned long & length) { if (ReadFile(m_portHandle, // handle of file to read inputData, // handle of file to read sizeBuffer, // number of bytes to read &length, // pointer to number of bytes read NULL) == 0) // pointer to structure for data { // AfxMessageBox("Reading of serial communication has problem."); return FALSE; } if (length > 0) { inputData[length] = NULL; // Assign end flag of message. return TRUE; } return TRUE; }

BOOL SerialCtrl::Write(const char * outputData, const unsigned int & sizeBuffer, unsigned long & length) { if (length > 0) { if (WriteFile(m_portHandle, // handle to file to write to outputData, // pointer to data to write to file sizeBuffer, // number of bytes to write &length,NULL) == 0) // pointer to number of bytes written { AfxMessageBox(L"Reading of serial communication has problem."); return FALSE; } return TRUE; } return FALSE; }

aus WinBase.h

WriteFile( __in HANDLE hFile, __in_bcount_opt(nNumberOfBytesToWrite) LPCVOID lpBuffer, __in DWORD nNumberOfBytesToWrite, __out_opt LPDWORD lpNumberOfBytesWritten, __inout_opt LPOVERLAPPED lpOverlapped );

WINBASEAPI BOOL WINAPI ReadFile( __in HANDLE hFile, __out_bcount_part_opt(nNumberOfBytesToRead, *lpNumberOfBytesRead) __out_data_source(FILE) LPVOID lpBuffer, __in DWORD nNumberOfBytesToRead, __out_opt LPDWORD lpNumberOfBytesRead, __inout_opt LPOVERLAPPED lpOverlapped );

Read the rhubric please - code in code tags, datasheets and schematics please...

OK.
This is the Communication Guide for the EPOS.

http://www.cse.dmu.ac.uk/~eg/tele/EPOS_Communication_Guide_E.pdf

I use a SHD RS232 Shield for Arduino to connect to the EPOS:

http://www.cutedigi.com/arduino-shields/rs232-shield-for-arduino.html

With the EPOS Application it’s working.Also with the Windows Visual Studios 2010. I added the Code for WV. It’s no problem of the Setting in EPOS.I just don’t know how to write the sketch.

Test_sio.txt (9.73 KB)

SerialCtrl.txt (11.8 KB)

Hi,
thank for the “help”.
For everyone who has the same problem in the txt-File is the solution to set the velocity.

Sketch.txt (1.52 KB)

i just got two questions regarding the EPOS2: Do you have to preset the communication via RS232 in the maxon studio, or did it work out of the box? And did you have to enable the EPOS2 before or was it activated, by only receiving the velocity command?

Because for me it's not working out of the box...

Thanks and cheers

lukas_b:
i just got two questions regarding the EPOS2:
Do you have to preset the communication via RS232 in the maxon studio, or did it work out of the box?
And did you have to enable the EPOS2 before or was it activated, by only receiving the velocity command?

Because for me it’s not working out of the box…

Thanks and cheers

Do you have some information?