用宏实现HEX到ASCII ,ASCII 到HEX

#define HEX2ASCII(value, data)  do{  \            value = (value > 0x09)?(value+0x7):value; \            *data = value + 0x30; \           }while(0)

#define ASCII2HEX(value, data)  do{  \            value = *data; \            value = (value > 0x40)?(value - 0x7):value; \           }while(0)

posted on 2015-03-09 20:00  程良  阅读(734)  评论(0编辑  收藏  举报

导航