$P$-fuzzy sets are considered as mappings from an arbitrary nonempty set $S$ into a partially ordered set $P$. The necessary and sufficient conditions are given under which a family $P$ of subsets of $S$ represents a collection of level subsets for a fuzzy set $\bar A\colon S\to P$. Thus the conditions are obtained under which a binary block-code $V$ can be ordered, so that it uniquely determines a $P$—fuzzy set and vice-versa. An explicit description of a Hamming distance for such codes is given, and it is shown that some well known binary block-codes (BCD, Gray’s codes) can be represented by $P$fuzzy sets.