We investigate the formation of carbon stars as a function of the stellar mass and parent metallicity . Theoretical modelling is based on an improved scheme for treating the third dredge-up in synthetic calculations of thermally pulsing asymptotic giant branch ( TP-AGB ) stars . In this approach , the usual criterion ( based on a constant minimum core mass for the occurrence of dredge-up , M _ { c } ^ { min } ) is replaced by one on the minimum temperature at the base of the convective envelope , T _ { b } ^ { dred } , at the stage of the post-flash luminosity maximum . Envelope integrations then allow determination of M _ { c } ^ { min } as a function of stellar mass , metallicity , and pulse strength ( see Wood 1981 ) , thus inferring if and when dredge-up first occurs . Moreover , the final possible shut down of the process is predicted . Extensive grids of TP-AGB models were computed by Marigo ( 1998ab ) using this scheme . In this paper , we present and discuss the calibration of the two dredge-up parameters ( i.e . efficiency \lambda and T _ { b } ^ { dred } ) aimed at reproducing the carbon star luminosity function ( CSLF ) in the LMC , using TP-AGB models with original metallicity Z = 0.008 . In addition to this , the effects of different input quantities on the theoretical CSLF are analysed . It turns out that the faint tail is almost insensitive to the history of star formation rate ( SFR ) in the parent galaxy , in contrast to the bright wing which may be more affected by the details of the recent history . Actually , we find that the faint end of the CSLF is essentially determined by the temperature parameter T _ { b } ^ { dred } . Once the faint end is reproduced , the peak location is a stringent calibrator of the efficiency parameter \lambda . The best fit to the observed CSLF in the LMC is obtained with \lambda = 0.50 , \log T _ { b } ^ { dred } = 6.4 , and a constant SFR up to an age of about 5 \times 10 ^ { 8 } yr . This recent drop of the SFR is invoked to remove a slight excess of bright carbon stars otherwise predicted . A good fit to the observed CSLF in the SMC is then easily derived from the Z = 0.004 models , with a single choice of parameters \lambda = 0.65 , \log T _ { b } ^ { dred } = 6.4 , and a constant SFR over the entire significant age interval . The result for \lambda is consistent with the theoretical expectation that the third dredge-up is more efficient at lower metallicities .