Let's Make Robots!

rs232

Matlab and PICAXE comms

Anyone out there who knows how to make Matlab work with serial communications?

I'm in the early stages of writing a matlab program to do inverse kinematics for a leggy kinda robot, and I want to get it to send the numbers to a picaxe via rs232 - seems fairly straightforward?

My test program is behaving wierdly

*code*

 

Picaxe = serial('COM4');

set(Picaxe,'BaudRate', 9600, 'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'none'); 

fopen(Picaxe);

fprintf(Picaxe,'1234');

Picaxe.ValuesSent

B = fread(Picaxe)

Cable used to program standalone AVR (Arduino) chips (ATMEGA328p)
  This weekend I made me a "cable" to program my ATMEGA328p chips the Arduino way. As usual by design goal is to use what I have rather than buy a solution, in … Read more
This Delta Robot is made from ply wood and aluminium. Cheap servo motors for the positioning. Atmel Attiny2313 for controlling the servos over RS232 with MATLAB. … Read more

RS232 Communication with MCU

So I am making my own CNC - PCB Miller. It is communicating with the computer using RS232 (UART), but in my testing, I find that I don't always get the correct characters, even at 1200baud. Does anyone have a method to suggest for error-checking an incoming data string over serial? I was thinking of doing something like this:

CPU sends data to MCU 4 times.

MCU checks to make sure the data is repeated exactly 4 times.

--If yes->send "OK" 4 times

--If no->send "NOT OK" 4 times

If CPU receives OK, queue up the next data to send