dear.. All. I wish to create Stepper project, with command line controlled, i modified Traffic example on keil c51 sample, with like this:
#include <reg52.h> #include <stdio.h> #include <rtx51tny.h> /* RTX-51 tiny functions & defines */ #include <ctype.h> /* character functions */ #include <string.h> /* string and memory functions */ char code menu[] = "\n" "+***** STEPPER MOTOR CONTROLLER ******+\n" "+ S : Set Waktu Mulai +\n" "+ D : Tampilkan Waktu +\n" "+ E : Set Waktu Berakhir +\n" "+ T : Set Waktu +\n" "+ L : Ubah Arah Menjadi Ke Kiri +\n" "+ R : Ubah Arah Menjadi Ke Kanan +\n" "+ F : Mode FULL STEP +\n" "+ H : Mode HALF STEP +\n" "+-------+-----------------------------+\n"; unsigned char code ful_seq_pat[4] = {10,9,5,6};//{1,4,2,8}; //{1,2,4,8}; unsigned char code half_seq_pat[8] = {0xfa,0xf8,0xf9,0xf1,0xf5,0xf4,0xf6,0xf2}; // Half Step Pattern // 11111010,11111000,11111001,11110001,11110101,11110100,11110110,11110010 extern getline (char idata *, char); /* external function: input line */ extern serial_init (); /* external function: init serial UART */ #define INIT 0 /* task number of task: init */ #define COMMAND 1 /* task number of task: command */ #define CLOCK 2 /* task number of task: clock */ #define BLINKING 3 /* task number of task: blinking */ #define LIGHTS 4 /* task number of task: signal */ //#define KEYREAD 4 /* task number of task: keyread */ #define GET_ESC 5 /* task number of task: get_escape */ //#define COUNTER_TM 6 sfr dataport = 0x80;//0x90; bit direction; bit step_mode; bit timed_out; struct time { /* structure of the time record */ unsigned char hour; /* hour */ unsigned char min; /* minute */ unsigned char sec; /* second */ }; struct time ctime = { 12, 0, 0 }; /* storage for clock time values */ struct time start = { 7, 30, 0 }; /* storage for start time values */ struct time end = { 18, 30, 0 }; /* storage for end time values */ char idata inline[16]; /* storage for command input line */ unsigned char idata sequencer; //unsigned int idata timer_like,buf_timer_like; /******************************************************************************/ /* Task 0 'init': Initialize */ /******************************************************************************/ void init (void) _task_ INIT { /* program execution starts here */ serial_init (); /* initialize the serial interface */ sequencer = 0; direction = 0; step_mode = 0; //timed_out = 0; //buf_timer_like = 1; //timer_like = buf_timer_like; os_create_task (CLOCK); os_create_task (COMMAND); /* start command task */ os_create_task (LIGHTS); /* start lights task */ //os_create_task (COUNTER_TM); //os_create_task (KEYREAD); /* start keyread task */ os_delete_task (INIT); /* stop init task (no longer needed) */ } bit display_time = 0;
using it on an Infineon XC8xx device (that is designed for Motor control) makes perfectly sense. It MAY, but when the question is "more speed" it hardly does. Adding overhead will, by definition reduce speed and, convesely, removing it will increase speed. If the product is very complex and not time critical nature there may, even for the '51 (which is singularily unsuited), be an argument for using a RTOS. I have no problem whatsoever with using a RTOS on a suitable processor Erik