diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9817c0f235ffa25c76bf4d744b4d22511c4f571e..8203d5ce8ed19e37ce6cfe4b324e02de81133183 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,7 +2,7 @@ ADD_SUBDIRECTORY(mtn)
 ADD_SUBDIRECTORY(bin)
 # locate the necessary dependencies
 # add the necessary include directories
-INCLUDE_DIRECTORIES(. ./mtn)
+INCLUDE_DIRECTORIES(. ./mtn ./bin)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/mtn)
 # application source files
 SET(sources bioloid_motion_pages.cpp)
diff --git a/src/bioloid_motion_pages.cpp b/src/bioloid_motion_pages.cpp
index 27fa5098ac654da96fc2374b7ab46c5bcbfcb5d0..557ecd62516cc5cd95f53faeac70c5302f4d7a91 100755
--- a/src/bioloid_motion_pages.cpp
+++ b/src/bioloid_motion_pages.cpp
@@ -3,10 +3,13 @@
 #include <string.h>
 
 #include "mtn_file_parser.hpp"
+#include "bin_file_parser.h"
 
 int main(const int argc,char *argv[])
 {
   std::vector<unsigned short int> angles;
+  MTN::MTN_File_Parser mtn_parser;
+  CBinFileParser bin_parser;
   unsigned int i=0,j=0,k=0;
   CMtnFile *motions;
   CMtnPage *page;
@@ -21,9 +24,13 @@ int main(const int argc,char *argv[])
   {
     if(strstr(argv[1],".mtn")!=NULL)
     {
+      mtn_parser.parse(argv[1]);
+      motions=mtn_parser.get_motions();
     }
     else if(strstr(argv[1],".bin")!=NULL)
     {
+      bin_parser.parse(argv[1]);
+      motions=bin_parser.get_motions(); 
     }
     else
     {
@@ -31,10 +38,7 @@ int main(const int argc,char *argv[])
       return (EXIT_FAILURE);
     }
   }
-  MTN::MTN_File_Parser mtn_parser;
-  mtn_parser.parse(argv[1]);
-  motions=mtn_parser.get_motions();
-  
+  /* show motion pages */
   std::cout << "Num. pages: " << motions->get_num_pages() << std::endl;
   for(i=0;i<motions->get_num_pages();i++)
   {
@@ -59,6 +63,10 @@ int main(const int argc,char *argv[])
     }
     
   }
+  /* generate the stm32 c code for the motion pages */
+  std::cout << "#include \"motion_pages.h\"\n" << std::endl << std::endl;
+  std::cout << "TPage motion_pages[MAX_PAGES] __attribute__ ((section (\".pages\")))={\n" << std::endl;
+
 
   return(EXIT_SUCCESS);
 }
diff --git a/src/mtn_file.cpp b/src/mtn_file.cpp
deleted file mode 100644
index 7fe8e0d96c3c0b733dcb6a27d7df5de31d500485..0000000000000000000000000000000000000000
--- a/src/mtn_file.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-#include "mtn_file.h"
-
-CMtnFile::CMtnFile()
-{
-  this->type="";
-  this->version=0.0;
-  this->enable.clear();  
-  this->motor_type.clear();
-  this->pages.clear();
-}
-
-void CMtnFile::set_type(std::string &type)
-{
-  this->type=type;
-}
-
-void CMtnFile::set_version(double version)
-{
-  this->version=version;
-}
-
-void CMtnFile::set_num_servos(unsigned int num_servos)
-{
-  this->enable.resize(num_servos);
-  this->motor_type.resize(num_servos);
-}
-
-void CMtnFile::set_enable(unsigned int servo,bool enable)
-{
-  if(servo>this->enable.size())
-  {
-    /* handle errors */
-  }
-  else
-    this->enable[servo]=enable;
-}
-
-void CMtnFile::set_enables(std::vector<bool> &enables)
-{
-  unsigned int i=0;
-
-  if(this->enable.size()!=enables.size())
-  {
-    /* handle errors */
-  }
-  else
-    for(i=0;i<this->enable.size();i++)
-      this->enable[i]=enables[i];
-}
-
-void CMtnFile::set_motor_type(unsigned int servo, int motor_type)
-{
-  if(servo>this->motor_type.size())
-  {
-    /* handle errors */
-  }
-  else
-    this->motor_type[servo]=motor_type;
-}
-
-void CMtnFile::set_motor_types(std::vector<int> &motor_types)
-{
-  unsigned int i=0;
-
-  if(this->motor_type.size()!=motor_types.size())
-  {
-    /* handle errors */
-  }
-  else
-    for(i=0;i<this->motor_type.size();i++)
-      this->motor_type[i]=motor_types[i];
-}
-
-void CMtnFile::add_page(CMtnPage *page)
-{
-  this->pages.push_back(page);
-}
-
-std::string CMtnFile::get_type(void)
-{
-  return this->type;
-}
-
-double CMtnFile::get_version(void)
-{
-  return this->version;
-}  
-
-unsigned int CMtnFile::get_num_servos(void)
-{
-  return this->enable.size();
-}
-
-bool CMtnFile::get_enable(unsigned int servo)
-{
-  if(servo>this->enable.size())
-  {
-    /* handle errors */
-  }
-  else
-    return this->enable[servo];
-}
-
-std::vector<bool> CMtnFile::get_enables(void)
-{
-  return this->enable;
-}
-
-int CMtnFile::get_motor_type(unsigned int servo)
-{
-  if(servo>this->motor_type.size())
-  {
-    /* handle errors */
-  }
-  else
-    return this->motor_type[servo];
-}
-
-std::vector<int> CMtnFile::get_motor_types(void)
-{
-  return this->motor_type;
-}
-
-unsigned int CMtnFile::get_num_pages(void)
-{
-  return this->pages.size();
-}
-
-CMtnPage *CMtnFile::get_page(unsigned int page)
-{
-  if(page>this->pages.size())
-  {
-    /* handle errors */
-  }
-  else
-    return this->pages[page];
-}
-
-CMtnFile::~CMtnFile()
-{
-  unsigned int i=0;
-
-  this->type="";
-  this->version=0.0;
-  this->enable.clear();  
-  this->motor_type.clear();
-  for(i=0;i<this->pages.size();i++)
-  {
-    delete this->pages[i];
-    this->pages[i]=NULL;
-  }
-  this->pages.clear();
-}
-
diff --git a/src/mtn_file.h b/src/mtn_file.h
deleted file mode 100644
index edd2f5591c5bbd5102f290c9f112a1fc515b012b..0000000000000000000000000000000000000000
--- a/src/mtn_file.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _MTN_FILE_H
-#define _MTN_FILE_H
-
-#include "mtn_page.h"
-
-class CMtnFile
-{
-  private:
-    std::string type;
-    double version;
-    std::vector<bool> enable;
-    std::vector<int> motor_type;
-    std::vector<CMtnPage *> pages;
-  public:
-    CMtnFile();
-    void set_type(std::string &type);
-    void set_version(double version);
-    void set_num_servos(unsigned int num_servos);
-    void set_enable(unsigned int servo,bool enable);
-    void set_enables(std::vector<bool> &enables);
-    void set_motor_type(unsigned int servo, int motor_type);
-    void set_motor_types(std::vector<int> &motor_types);
-    void add_page(CMtnPage *page);
-    std::string get_type(void);
-    double get_version(void);
-    unsigned int get_num_servos(void);
-    bool get_enable(unsigned int servo);
-    std::vector<bool> get_enables(void);
-    int get_motor_type(unsigned int servo);
-    std::vector<int> get_motor_types(void);
-    unsigned int get_num_pages(void);
-    CMtnPage *get_page(unsigned int page);
-    ~CMtnFile();
-};
-
-#endif
diff --git a/src/mtn_page.cpp b/src/mtn_page.cpp
deleted file mode 100644
index ea95321bb365edc54209971ef7d2223573f7c830..0000000000000000000000000000000000000000
--- a/src/mtn_page.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-#include "mtn_page.h"
-
-CMtnPage::CMtnPage(unsigned int num_servos)
-{
-  this->name="";
-  this->compliance.resize(num_servos);
-  this->next_page=-1;
-  this->exit_page=-1;
-  this->repetitions=0;
-  this->speed_rate=0;
-  this->inertial=-1;
-  this->steps.clear();
-}
-
-void CMtnPage::set_name(std::string &name)
-{
-  this->name=name;
-}
-
-void CMtnPage::set_compliance(unsigned int servo,unsigned int compliance)
-{
-  if(servo>this->compliance.size())
-  {
-    /* handle errors */
-  }
-  else
-    this->compliance[servo]=compliance;
-}
-
-void CMtnPage::set_compliances(std::vector<unsigned int> compliances)
-{
-  unsigned int i=0;
-
-  if(this->compliance.size()!=compliances.size())
-  {
-    /* handle errors */
-  }
-  else
-  {
-    for(i=0;i<this->compliance.size();i++)
-      this->compliance[i]=compliances[i];
-  }
-}
-
-void CMtnPage::set_next_page(unsigned int page)
-{
-  if(page>=256)
-  {
-    /* handle errors */
-  }
-  else
-    this->next_page=page;
-}
-
-void CMtnPage::set_exit_page(unsigned int page)
-{
-  if(page>=256)
-  {
-    /* handle errors */
-  }
-  else
-    this->exit_page=page;
-}
-
-void CMtnPage::set_repetitions(unsigned int num)
-{
-  if(num>=256)
-  {
-    /* handle errors */
-  }
-  else
-    this->repetitions=num;
-}
-
-void CMtnPage::set_speed_rate(double rate)
-{
-  this->speed_rate=rate;
-}
-
-void CMtnPage::set_inertial(unsigned int inertia)
-{
-  if(inertia>=256)
-  {
-    /* handle errors */
-  }
-  else
-    this->inertial=inertia;
-}
-
-void CMtnPage::add_step(CMtnStep *step)
-{
-  if(this->steps.size()>=7)
-  {
-    /* handle errors */
-  }
-  else
-    this->steps.push_back(step);
-}
-
-std::string CMtnPage::get_name(void)
-{
-  return this->name;
-}
-
-unsigned int CMtnPage::get_compliance(unsigned int servo)
-{
-  if(servo>this->compliance.size())
-  {
-    /* handle errors */
-  }
-  else
-    return this->compliance[servo];
-}
-
-std::vector<unsigned int> CMtnPage::get_compliances(void)
-{
-  return this->compliance;
-}
-
-unsigned int CMtnPage::get_next_page(void)
-{
-  return this->next_page;
-}
-
-unsigned int CMtnPage::get_exit_page(void)
-{
-  return this->exit_page;
-}
-
-unsigned int CMtnPage::get_repetitions(void)
-{
-  return this->repetitions;
-}
-
-double CMtnPage::get_speed_rate(void)
-{
-  return this->speed_rate;
-}
-
-unsigned int CMtnPage::get_inertial(void)
-{
-  return this->inertial;
-}
-
-unsigned int CMtnPage::get_num_steps(void)
-{
-  return this->steps.size();
-}
-
-CMtnStep *CMtnPage::get_step(unsigned int step)
-{
-  if(step>this->steps.size())
-  {
-    /* handle error */
-  }
-  else
-    return this->steps[step];
-}
-
-CMtnPage::~CMtnPage()
-{
-  unsigned int i=0;
-
-  this->name.clear();
-  this->compliance.clear();
-  this->next_page=-1;
-  this->exit_page=-1;
-  this->repetitions=0;
-  this->speed_rate=0;
-  this->inertial=-1;
-  for(i=0;i<this->steps.size();i++)
-  {
-    delete this->steps[i];
-    this->steps[i]=NULL;
-  }
-  this->steps.clear();
-}
-
diff --git a/src/mtn_page.h b/src/mtn_page.h
deleted file mode 100644
index 22549e10671451bf8bbe8c4323d554962b4c45fc..0000000000000000000000000000000000000000
--- a/src/mtn_page.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _MTN_PAGE_H
-#define _MTN_PAGE_H
-
-#include "mtn_step.h"
-#include <string>
-
-class CMtnPage
-{
-  private:
-    std::string name;
-    std::vector<unsigned int> compliance;
-    unsigned int next_page;
-    unsigned int exit_page;
-    unsigned int repetitions;
-    double speed_rate;
-    unsigned int inertial;
-    std::vector<CMtnStep *> steps;
-  public:
-    CMtnPage(unsigned int num_servos);
-    void set_name(std::string &name);
-    void set_compliance(unsigned int servo,unsigned int compliance);
-    void set_compliances(std::vector<unsigned int> compliances);
-    void set_next_page(unsigned int page);
-    void set_exit_page(unsigned int page);
-    void set_repetitions(unsigned int num);
-    void set_speed_rate(double rate);
-    void set_inertial(unsigned int inertia);
-    void add_step(CMtnStep *step);
-    std::string get_name(void);
-    unsigned int get_compliance(unsigned int servo);
-    std::vector<unsigned int> get_compliances(void);
-    unsigned int get_next_page(void);
-    unsigned int get_exit_page(void);
-    unsigned int get_repetitions(void);
-    double get_speed_rate(void);
-    unsigned int get_inertial(void);
-    unsigned int get_num_steps(void);
-    CMtnStep *get_step(unsigned int step);
-    ~CMtnPage();
-};
-
-#endif
diff --git a/src/mtn_step.cpp b/src/mtn_step.cpp
deleted file mode 100644
index 377cf35835a0af30611320a60ccd936c3904df3b..0000000000000000000000000000000000000000
--- a/src/mtn_step.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "mtn_step.h"
-
-CMtnStep::CMtnStep(unsigned int num_servos)
-{
-  this->angles.resize(num_servos);
-  this->pause_time=0.0;
-  this->step_time=0.0;
-}
-
-void CMtnStep::set_angle(unsigned int servo,unsigned short int angle)
-{
-  if(servo>this->angles.size())
-  {
-    /* handle errors */
-  }
-  else
-    this->angles[servo]=angle;
-}
-
-void CMtnStep::set_angles(std::vector<unsigned short int> &angles)
-{
-  unsigned int i=0;
-
-  if(angles.size()!=this->angles.size())
-  {
-    /* handle errors */
-  }
-  else
-  {
-    for(i=0;i<angles.size();i++)
-      this->angles[i]=angles[i];
-  }
-}
-
-void CMtnStep::set_pause_time(double time)
-{
-  if(time<0.0)
-  {
-    /* handle errors */
-  }
-  else
-    this->pause_time=time;
-}
-
-void CMtnStep::set_step_time(double time)
-{
-  if(time<0.0)
-  {
-    /* handle errors */
-  }
-  else
-    this->step_time=time;
-}
-
-unsigned short int CMtnStep::get_angle(unsigned int servo)
-{
-  if(servo>this->angles.size())
-  {
-    /* handler errors */
-  }
-  else
-    return this->angles[servo];
-}
-
-std::vector<unsigned short int> CMtnStep::get_angles(void)
-{
-  return this->angles;
-}
-
-double CMtnStep::get_pause_time(void)
-{
-  return this->pause_time;
-}
-
-double CMtnStep::get_step_time(void)
-{
-  return this->step_time;
-}
-
-CMtnStep::~CMtnStep()
-{
-  this->angles.clear();
-  this->pause_time=0.0;
-  this->step_time=0.0;
-}
-
diff --git a/src/mtn_step.h b/src/mtn_step.h
deleted file mode 100644
index f85b4f17977e572f11441ebd74068ed6f680b6f8..0000000000000000000000000000000000000000
--- a/src/mtn_step.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _MTN_STEP_H
-#define _MTN_STEP_H
-
-#include <vector>
-
-class CMtnStep
-{
-  private:
-    std::vector<unsigned short int> angles;
-    double pause_time;
-    double step_time;
-  public:
-    CMtnStep(unsigned int num_servos);
-    void set_angle(unsigned int servo,unsigned short int angle);
-    void set_angles(std::vector<unsigned short int> &angles);
-    void set_pause_time(double time);
-    void set_step_time(double time);
-    unsigned short int get_angle(unsigned int servo);
-    std::vector<unsigned short int> get_angles(void);
-    double get_pause_time(void);
-    double get_step_time(void);
-    ~CMtnStep();
-};
-
-#endif
diff --git a/src/stm32_src_mtn.h b/src/stm32_src_mtn.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b0b6bed2ac8197ee5ae870d829218f8648152ca
--- /dev/null
+++ b/src/stm32_src_mtn.h
@@ -0,0 +1,15 @@
+#ifndef _STM32_SRC_MTN_H
+#define _STM32_SRC_MTN_H
+
+#include "mtn_file.h";
+
+class CSTM32SrcMtn
+{
+  private:
+    CMtnFile *motions;
+  public:
+    CSTM32SrcMtn();
+    ~CSTM32SrcMtn();
+};
+
+#endif