We have conducted a survey of CN N=2-1 and N=1-0 line emission in the
envelopes of evolved stars. The sample consists of 42 objects, includi
ng C-rich and O-rich envelopes, S-stars, detached envelopes, and proto
-planetary nebulae. Confident detections have been achieved in 30 obje
cts. Both CN lines are bright in C-rich envelopes, and the 2-1 line ha
s been detected in 5 O-rich objects (previously, CN had been detected
in only one O-rich envelope). The excitation temperature T-rot, evalua
ted from the 2-1/1-0 intensity ratio, is similar to 3-6 K in most carb
on stars, and greater than or equal to 10-20 K in O-rich envelopes. We
find that the CN spectra display anomalies in the rotational, fine, a
nd hyperfine line ratios. Anomalies in the rotational excitation appea
r in W Ori and UU Aur, two stars which are known to present HCN upsilo
n=0 J=1-0 masers. The excitation of the CN 2-1 line is unusually high
in both objects, and UU Aur may present a weak maser effect in this li
ne. Anomalies are also observed in the intensity ratios of the fine an
d hyperfine components. If such anomalies were due to the envelope thi
ckness, the required line opacities would be excessively high, in part
icular for low mass-loss rate objects. We thus suggest that the observ
ed anomalies are the result of an anomalous excitation. Pumping throug
h the optical and near-IR bands seems to play a dominant role in the C
N excitation. A comparison with previously published HCN data shows th
at the CN/HCN ratio of the total numbers of molecules in C-rich stars
tends to be larger in the objects with lower mass-loss rate, supportin
g the idea that CN is mainly formed from the photodissociation of HCN.
The average peak abundance of CN is similar to 1.9 10(-5) in C-rich o
bjects, and is about 300 times smaller (similar to 6.6 10(-8)) in O-ri
ch envelopes. The CN/HCN peak abundance ratio is similar to 0.45 in C-
rich stars, in agreement with photodissociation chemical models, and s
imilar to 0.04 in O-rich objects. This last value is about two orders
of magnitude smaller than the predictions of standard chemical models,
and suggest that CN is destroyed by additional mechanisms than photod
issociation in O-rich envelopes.