I have herkulex motor(http://www.sgbotic.com/products/datasheets/robotics/herkulexeng.pdf)
I want to drive with psoc. There are 4 inputs on servo motor. 1-vcc 2-gnd 3- rx 4-tx . Can I drive the motor using uart in psoc. How should be uart parameters and code? Should I use half duplex full duplex uart? There is arduino library for motor. Can i import in psoc. There are several explanations in servo manual and I'm confused. How to write code for driving simply motor? Thanks..
Can't say about the above said motor but I Have driven a high toruqe DC motor using UART in PSoC and it worked quite well.
Just connect the motor RX-TX pins to the PSoC UART TX-RX pins respectively.
Check your motor datasheet for appropriate code to be sent via the PSoC uart block.
Regards.
I made the connection for uart but i have problem driving motor. I'm looking datasheet but how can drive it, I don't know
For my motor, there were commands to start/stop the motor .
For instance, to start the motor at 50 RPM speed, I had to send "S50"....& to stop the motor I had to send S0 via UART.
Regards.
Can you send me your motor project? So ı can see uart motor example
You should try first to connect to the motor via your PC, and uye a terminal program to control it. Realterm would make a nice client, since it can take hex values to send.
When you can drive the motor, and know how it needs to be operated, you can start writing a program on the PSoC for it.
Working with the UART is simple. Configure it as full-duplex, with the proper baud rate for your motor. Create a byte (uint8_t) array for your command, fill this array according to the protocol definition of the motor, and then hand it over to the UART.
On UART receive, take the received data and write it into another array. From there you can process the ACK responses.
Additionally I would suggest to measure the voltages at the herculex rs232 pins: I suppose they MIGHT be ttl/cmos-levels (5V) and not RS232 levels (+-12v) as they come from your PC.
When you use a Cypress PSoC3 Kit (-030) you have a serial interface on board that can be jumpered to use any of the forementioned levels, have a look into the schematic.
Programming is not easiy, but programming a device is not more difficult than programming, so concentrate on programming in C, set up your schematic and configure the UART as required in the herculex datasheet and start with reading out the status informations of the herculex.
Happy coding
Bob
The schematic on page 51 of the data sheet shows the interface. There is a MAX3232 driving the PC side, so it using standard RS232 levels (+-12V). So use either a real serial port, or a real USB-RS232 cable (not a serial-TTL to USB converter).
Thanks Psoc73,hli,bob;
I edited helper herkulex.h file but I looked uart examples I didn't solve component, so I don't write a code. Example Herkulex datasheet that
ID(253),r(LED Control, Address(0x35) request green led on.
For psoc; UART_PutChar(),UART_PutArray(uint8_t address) like. When I examined herkulex datasheet, I didn't find driving motor address map. I guess I need an example
i can't write programming code. I can drive whit helping herkulex manager kit but I can not do it with PSoC
Thanks Psoc73
The Herkulex motor uses RS232 TTL, from the datasheet -
As you can see, controller side is TTL, PC side full RS232 physical layer -
@TURASGAS.. you said you have problem with programming.....in such cases we mostly have to send certain commands for the motor to work as per our need, and that can be done by simple TX APIs as described in the UART block!!!!!
Page 18 clearly suggests that you have to send a packet in a specified format.
Try this....to send the TWO BYTES OF HEADER...
main()
{
uint16 h = 255; // 0xFF
UART_1_PutChar(h); // first byte of header
UART_1_PutChar(h); // second byte of header
}
Accordingly you can send the rest of the packet contents.
------------------------------------------------------------
Also keep in mind the voltage-level settings as prescribed by others.....Luckily, my motor was TTL compatible...so I could directly connect my motor pins to my PSoC.
Regards.
Thanks Goose, Psoc73
http://robottini.altervista.org/dongbu-herkulex-arduino-library-2 . Before I looked at this site. I need to occur header file for be working this codes. I try to occur header file but get some error or there are some tricks for creating a header file.