We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I write a program as following. I want to point a table for driving step motor to ccw or cw. But I cant access code table data. Please help me. Thanx.
#include <reg52.h>
void main(void) {
unsigned char code uc_code_SMCW_Table[8]={0x09,0x01,0x02,0x03,0x06,0x04,0x0c,0x08};
unsigned char code uc_code_SMCCW_Table[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};
unsigned char code *uc_code_SM_Table_Ptr;
unsigned char data uc_data_SM_Table_Index;
uc_data_SM_Table_Index=1;
switch(uc_data_SM_Table_Index) {
case 1:
uc_code_SM_Table_Ptr=uc_code_SMCW_Table;
break;
case 2:
uc_code_SM_Table_Ptr=uc_code_SMCCW_Table;
}
//The result is not correct.
uc_data_SM_Table_Index=uc_code_SM_Table_Ptr[0];
Why don't you write what is the "expected" result and the "actual" result? People should ask better questions, shouldn't they?