麻煩介紹下void send()等函數(shù)
代碼如下:unsigned char32 Slave_adr[8];unsigned char32 Slave_Send_adr[73];void bit_set(int32 x,int y){ int32 temp;temp=1;temp=temp<<y;x=x|temp;}void bit_clear(int32 x,int y){ int32 temp;temp=1;temp=temp<<y;temp=~temp;x=x&temp;}int1 bit_test(int32 x,int y){ int32 temp;temp=1;temp=temp1<<y;temp=x&temp;if(temp) return(1);else return(0);}//輸入?yún)?shù):x為從機(jī)號碼;void Slave_Address_set_bit(unsigned char *buff){ unsigned char quotient_Value; //用來放商值;unsigned char residue_Value; //用來放余數(shù);unsigned char x;x=atoi(buff);quotient_Value=x/32;residue_Value=x%32;bit_set(Slave_adr[quotient_Value],residue_Value); //更新Slave_adr[];}//輸入?yún)?shù):x為從機(jī)號碼;void Slave_Address_clear_bit(unsigned char *buff){ unsigned char quotient_Value; //用來放商值;unsigned char residue_Value; //用來放余數(shù);unsigned char x;x=atoi(buff);quotient_Value=x/32;residue_Value=x%32;bit_clear(Slave_adr[quotient_Value],residue_Value); //更新Slave_adr[];}//輸入?yún)?shù):x為從機(jī)號碼;bit Slave_Address_test_bit(unsigned char *buff){ unsigned char quotient_Value; //用來放商值;unsigned char residue_Value; //用來放余數(shù);unsigned char x;x=atoi(buff);bit temp_bit;quotient_Value=x/32;residue_Value=x%32;temp_bit=bit_test(Slave_adr[quotient_Value],residue_Value);return(temp_bit);}//函數(shù)功能:將Slave_adr[]中的數(shù)據(jù)轉(zhuǎn)換為16進(jìn)制ASCii碼,保存到Slave_Send_adr[]中void send(){ signed char i;unsigned char temp_array[5];int temp;memset(Slave_Send_adr,'\0',73);for(i=7;i>=0;i--){ memset(temp_array,'\0',5);temp=(int)(Slave_adr[i]>>4);sprintf(temp_array,"%Lx",temp); //將高16位轉(zhuǎn)換為16進(jìn)制ASCii碼;strcat(Slave_Send_adr,temp_array);temp=(int)Slave_adr[i];sprintf(temp_array,"%Lx",temp); //將低16位轉(zhuǎn)換為16進(jìn)制ASCii碼;strcat(Slave_Send_adr,temp_array);memset(temp_array,'\0',5);strcpy(temp_array,";")strcat(Slave_Send_adr,temp_array);}}如果麻煩就只翻譯unsigned char32 Slave_adr[8];unsigned char32 Slave_Send_adr[73];和這三個函數(shù)void bit_set(int32 x,int y)void Slave_Address_set_bit(unsigned char *buff)void send()
查看完整描述