Communicating Between the MBED and Serial port of AX500.

12 Mar 2012

My ax500 motor driver doesnt seem to echo back or even recognized the characters sent. It doesnt respond to the commands sent in the C program.

Good news is ax500 works with the serial port of the pc recognizing each commands input in hyperterm. It has to be the communication setting problem with the mbed that's why the ax500 isnt receiving anything.

/media/uploads/staffsuni100/communication_setting.png Ax500 Communication Setting.

Now I wonder if the 'start bit' is causing the problem because the mbed Serial port doesn't mention anything about 'start bit'.http://mbed.org/projects/libraries/api/mbed/trunk/Serial#Serial.format

Heres the pdf manual for the ax500 for RS232 mode. Page 104 is where the communuication settings are at. http://www.roboteq.com/files_n_images/files/manuals/ax500man19b-060107.pdf

#include "mbed.h"

Serial pc(USBTX, USBRX);
Serial ax500(p9,p10);
DigitalOut led1(LED1);
int i;

int main() {
    ax500.baud(9600);
    ax500.format(7,Serial::Even,1); //Communication Setting for Ax500
    
 for(i=0;i<10;i++) { // Carriage Return '10' times to enter RS232 mode
  ax500.putc(0x0D);
  }
    
    while(1) {
           ax500.printf("!A50\n"); // Input speed for motors.
           pc.putc(ax500.getc() + 1);

                   
            led1 = !led1;
    }
}

Maybe theres something wrong with my program but p9 outputs exactly how I want(using scope to view).

  • Edit: Yeah it's definitely a problem with the commuication setting. When waiting for response, it'se suppose to output 'W' every sec. but now it ouputs '#'.