systemlib.h File Reference

Go to the source code of this file.

Functions

INT8U SystemlibHex2AsciiCharGet (INT8U Data)
INT32U SystemlibAscii2HexNumberGet (INT8U *pString)
INT8U SystemlibStringLength (INT8U *pString)
void SystemlibStringCopy (INT8U *pSource, INT8U *pDestination)


Function Documentation

INT32U SystemlibAscii2HexNumberGet ( INT8U pString  ) 

Definition at line 17 of file systemlib.c.

00017                                                   {
00018     INT8U i,j;
00019     INT32U k;
00020     INT8U *pData;
00021 
00022     if(pString==(INT8U *)0) return 0; // null string pointer
00023     pData=pString;
00024     for(i=0;i<9;i++) if(*pData++==0) break;
00025     if((i==0)||(i==9)) return 0; // string too large
00026     k=0;
00027     if(i==8){
00028         j=*pString++;
00029         if((j>='0')&&(j<='9')) j=j-'0';
00030         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00031         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00032         else return 0; // invalid char
00033         k+=(INT32U)j<<28;
00034         i--; 
00035     } 
00036     if(i==7){
00037         j=*pString++;
00038         if((j>='0')&&(j<='9')) j=j-'0';
00039         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00040         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00041         else return 0; // invalid char
00042         k+=(INT32U)j<<24; 
00043         i--;
00044     } 
00045     if(i==6){
00046         j=*pString++;
00047         if((j>='0')&&(j<='9')) j=j-'0';
00048         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00049         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00050         else return 0; // invalid char
00051         k+=(INT32U)j<<20; 
00052         i--;
00053     } 
00054     if(i==5){
00055         j=*pString++;
00056         if((j>='0')&&(j<='9')) j=j-'0';
00057         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00058         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00059         else return 0; // invalid char
00060         k+=(INT32U)j<<16; 
00061         i--;
00062     } 
00063     if(i==4){
00064         j=*pString++;
00065         if((j>='0')&&(j<='9')) j=j-'0';
00066         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00067         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00068         else return 0; // invalid char
00069         k+=(INT32U)j<<12; 
00070         i--;
00071     } 
00072     if(i==3){
00073         j=*pString++;
00074         if((j>='0')&&(j<='9')) j=j-'0';
00075         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00076         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00077         else return 0; // invalid char
00078         k+=(INT32U)j<<8; 
00079         i--;
00080     } 
00081     if(i==2){
00082         j=*pString++;
00083         if((j>='0')&&(j<='9')) j=j-'0';
00084         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00085         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00086         else return 0; // invalid char
00087         k+=(INT32U)j<<4; 
00088         i--;
00089     } 
00090     if(i==1){
00091         j=*pString++;
00092         if((j>='0')&&(j<='9')) j=j-'0';
00093         else if((j>='a')&&(j<='f')) j=j-'a'+10;
00094         else if((j>='A')&&(j<='F')) j=j-'A'+10;
00095         else return 0; // invalid char
00096         k+=(INT32U)j; 
00097     } 
00098     return k;
00099 }

INT8U SystemlibHex2AsciiCharGet ( INT8U  Data  ) 

Definition at line 105 of file systemlib.c.

00105                                            {
00106     //if((Data>=0)&&(Data<=9)) Data+=0x30;
00107     if(Data<=9) Data+=0x30;
00108     else if((Data>=10)&&(Data<=15)) Data+=55;
00109     else Data=0;
00110     return Data;
00111 }

void SystemlibStringCopy ( INT8U pSource,
INT8U pDestination 
)

Definition at line 130 of file systemlib.c.

00130                                                             {
00131     while(*pSource!=0){
00132         *pDestination=*pSource;
00133         pSource++;
00134         pDestination++;
00135     }
00136 }

INT8U SystemlibStringLength ( INT8U pString  ) 

Definition at line 117 of file systemlib.c.

00117                                            {
00118      ucTemp=0;
00119      while(*pString!=0){
00120          pString++;
00121          ucTemp++;
00122      }
00123      return ucTemp;
00124 }


Generated on Tue Jul 7 20:39:56 2009 for A SIMPLE APPLICATION FOR PIC18F87J10 by  doxygen 1.5.9