Index: trunk/Poubelle/archediab.old/archediab.sources/c/dilution.c
===================================================================
--- trunk/Poubelle/archediab.old/archediab.sources/c/dilution.c	(revision 639)
+++ trunk/Poubelle/archediab.old/archediab.sources/c/dilution.c	(revision 643)
@@ -16,13 +16,37 @@
 
 
-#define  val_multiplex(i)	(0.0003052*(double)(blk->ADC_dil[i]-0x8000))	
-//#define  val_temperature(i)	(34.+ (300./4.4)*(4.4-val_multiplex(i))	)
-//#define  val_temperature(i)	((1146.3/(val_multiplex(i)-0.1)) - 245.13)
-#define  val_temperature(i)	((val_multiplex(i)<0.2)?-99:((1146.3/(val_multiplex(i)-0.1)) - 245.13))
-#define  cnt_temperature(i)	(20+(int)val_temperature(i))
+#define  cnt_temperature(i)	(20+(int)val_temperature(blk->ADC_dil[i]))
 
 #define  ecrit_switch(val,ii,bit) {if(val) ii=ii | bit ;else ii=ii& (0xffffffff^bit) ;}
 #define  calib(j)		litD(fenetre_dilution_calibration,j,0L)
 
+
+void  ecrit_moteur_dilution(int valeur);	// valeur sur 10 bit: poid fort=on/off
+
+void  ecrit_moteur_dilution(int valeur)
+{
+int i;
+char mot_tc[10];
+
+		i=litD(fenetre_dilution,dil_switch_1,0);
+i=i<<8; 	i+=litD(fenetre_dilution,dil_switch_2,0);
+i=i<<8;		i+=litD(fenetre_dilution,dil_switch_3,0);
+i=i<<8;		// les 3 octets en poid fort, rien dans le dernier octet
+i=i& 0x003fffff;
+i = i| ( (valeur & 0x3ff)<<22);
+ecritD(fenetre_dilution,dil_switch_1,(i>>24)&0xff);
+ecritD(fenetre_dilution,dil_switch_2,(i>>16)&0xff);
+ecritD(fenetre_dilution,dil_switch_3,(i>>8 )&0xff);
+
+mot_tc[0]=tc_switch_dil;
+mot_tc[1]=0;
+mot_tc[2]=0;
+mot_tc[3]=0;
+mot_tc[4]=(i>>8 )&0xff;
+mot_tc[5]=(i>>16)&0xff;
+mot_tc[6]=(i>>24)&0xff;
+mot_tc[7]=0;	
+emission_telecommande(tc_dir_transputer,mot_tc);
+}
 
 
@@ -139,5 +163,7 @@
 //    case dil_dac_1 :
 //   case dil_dac_2 :
-    case dil_envoi_dac :	ecrit_dac_dilution(); 	break;
+//   case dil_envoi_dac :	ecrit_dac_dilution(); 	break;
+   	case dil_envoi_dac :	ecrit_moteur_dilution((int)litD(fenetre_dilution,dil_dac_2,0));	// les 12 bits
+				break;
 
     default  :   break;
@@ -220,34 +246,34 @@
 // les pressions et debits metres des injections de la dilution
 ecritD(fenetre_dilution,dil_p_d_3He,"3He: %4.1fb -> %5.2fµm/s -> %4.1fb"
-	,40. 	*	val_multiplex(p_R3)  -1.6	//	200 bars pour 5V et 1.6 bar d'offset
-	,2. 	* 	val_multiplex(d_3He)		//  10 MICRO MOLES  pour  5V
-	,20. 	*	val_multiplex(p_C3)		//	100 bars pour 5V
+	,40. 	*	val_multiplex(blk->ADC_dil[ p_R3])  -1.6	//	200 bars pour 5V et 1.6 bar d'offset
+	,2. 	* 	val_multiplex(blk->ADC_dil[ d_3He])		//  10 MICRO MOLES  pour  5V
+	,20. 	*	val_multiplex(blk->ADC_dil[ p_C3])		//	100 bars pour 5V
 	);
 ecritD(fenetre_dilution,dil_p_d_4He,"4He: %4.1fb -> %5.2fµm/s -> %4.1fb"
-	,40. 	*	val_multiplex(p_R4)		//	200 bars pour 5V
-	,8. 	* 	val_multiplex(d_4He)		//  40 MICRO MOLES  pour  5V
-//	,4. 	* 	val_multiplex(d_4He)		//  20 MICRO MOLES  pour  5V
-	,20. 	*	val_multiplex(p_C4)		//	100 bars pour 5V
+	,40. 	*	val_multiplex(blk->ADC_dil[ p_R4])		//	200 bars pour 5V
+	,8. 	* 	val_multiplex(blk->ADC_dil[ d_4He])		//  40 MICRO MOLES  pour  5V
+//	,4. 	* 	val_multiplex(blk->ADC_dil[ d_4He])		//  20 MICRO MOLES  pour  5V
+	,20. 	*	val_multiplex(blk->ADC_dil[ p_C4])		//	100 bars pour 5V
 	);
 
 ecritD(fenetre_dilution,dil_p_air,"Van=%4.1fb  charb=%4.1fb  mmb=%4.3fb  haut=%4.3fb"
-	,20.*val_multiplex(p_air),20.*val_multiplex(p_charb)
-	,0.2*val_multiplex(p_memb),0.2*val_multiplex(p_haut)	);
+	,20.*val_multiplex(blk->ADC_dil[ p_air]),20.*val_multiplex(blk->ADC_dil[ p_charb])
+	,0.2*val_multiplex(blk->ADC_dil[ p_memb]),0.2*val_multiplex(blk->ADC_dil[ p_haut])	);
 			
 ecritD(fenetre_dilution,dil_piles," Trp=%4.1fV   Dil=%4.1fV / %4.1fV  \rBebo=%4.1fV   /   %4.1fV / %4.1fV  Ch=%4.1fV"
-	,2.03*val_multiplex(p_10T),3.90*val_multiplex(p_p18D),3.90*val_multiplex(p_m18D)
-	,2.03*val_multiplex(p_10B),3.90*val_multiplex(p_p18B),3.90*val_multiplex(p_m18B)
-	,3.8*val_multiplex(p_Ch));
+	,2.03*val_multiplex(blk->ADC_dil[ p_10T]),3.90*val_multiplex(blk->ADC_dil[ p_p18D]),3.90*val_multiplex(blk->ADC_dil[ p_m18D])
+	,2.03*val_multiplex(blk->ADC_dil[ p_10B]),3.90*val_multiplex(blk->ADC_dil[ p_p18B]),3.90*val_multiplex(blk->ADC_dil[ p_m18B])
+	,3.8*val_multiplex(blk->ADC_dil[ p_Ch]));
 
 /* valeur seuil au mini (5.3 ou 15.3V) , *17 =  +5.9 V au maxi	*/
 
 
-ecritD(fenetre_dilution,dil_p_10T,(int)(17*(2.03*val_multiplex(p_10T)-5.3)));
-ecritD(fenetre_dilution,dil_p_p18D,(int)(17*(3.90*val_multiplex(p_p18D)-15.3)));
-ecritD(fenetre_dilution,dil_p_m18D,(int)(17*(-3.90*val_multiplex(p_m18D)-15.3)));
-ecritD(fenetre_dilution,dil_p_10B,(int)(17*(2.03*val_multiplex(p_10B)-5.3)));
-ecritD(fenetre_dilution,dil_p_p18B,(int)(17*(3.93*val_multiplex(p_p18B)-15.3)));
-ecritD(fenetre_dilution,dil_p_m18B,(int)(17*(-3.93*val_multiplex(p_m18B)-15.3)));
-ecritD(fenetre_dilution,dil_p_Ch,(int)(10*(3.8*val_multiplex(p_Ch)-25)));	/* 25 a 35 V  */
+ecritD(fenetre_dilution,dil_p_10T,(int)(17*(2.03*val_multiplex(blk->ADC_dil[ p_10T])-5.3)));
+ecritD(fenetre_dilution,dil_p_p18D,(int)(17*(3.90*val_multiplex(blk->ADC_dil[ p_p18D])-15.3)));
+ecritD(fenetre_dilution,dil_p_m18D,(int)(17*(-3.90*val_multiplex(blk->ADC_dil[ p_m18D])-15.3)));
+ecritD(fenetre_dilution,dil_p_10B,(int)(17*(2.03*val_multiplex(blk->ADC_dil[ p_10B])-5.3)));
+ecritD(fenetre_dilution,dil_p_p18B,(int)(17*(3.93*val_multiplex(blk->ADC_dil[ p_p18B])-15.3)));
+ecritD(fenetre_dilution,dil_p_m18B,(int)(17*(-3.93*val_multiplex(blk->ADC_dil[ p_m18B])-15.3)));
+ecritD(fenetre_dilution,dil_p_Ch,(int)(10*(3.8*val_multiplex(blk->ADC_dil[ p_Ch])-25)));	/* 25 a 35 V  */
 
 //  --  les voyants de switch de piles
@@ -257,6 +283,6 @@
 
 ecritD(fenetre_dilution,dil_temperatures,"temp-Haut =   %4.1f°   %4.1f°   %4.1f°   %4.1f° \rtemp-Bas  =   %4.1f°   %4.1f°   %4.1f°   %4.1f°  "
-	,val_temperature(t_h1),val_temperature(t_h2),val_temperature(t_h3),val_temperature(t_h4)
-	,val_temperature(t_b1),val_temperature(t_b2),val_temperature(t_b3),val_temperature(t_b4)	
+	,val_temperature(blk->ADC_dil[ t_h1]),val_temperature(blk->ADC_dil[ t_h2]),val_temperature(blk->ADC_dil[ t_h3]),val_temperature(blk->ADC_dil[ t_h4])
+	,val_temperature(blk->ADC_dil[ t_b1]),val_temperature(blk->ADC_dil[ t_b2]),val_temperature(blk->ADC_dil[ t_b3]),val_temperature(blk->ADC_dil[ t_b4])	
 	);
 
@@ -277,9 +303,9 @@
 //  les afficheurs analogiques de pression helium et pirani  
 
-ecritD(fenetre_dilution,dil_RP_He,(int)(2500*val_multiplex(RP_He)-7500));
+ecritD(fenetre_dilution,dil_RP_He,(int)(2500*val_multiplex(blk->ADC_dil[ RP_He])-7500));
 //  je veux 10000 pour 0.8 bars  soit    alors que l'on a 5V pour 1 bar ou 1V = 0.2 bar
 //  soit multiplier par 2500
 // puis j'enleve 0.6 bars soit 7500 
-ecritD(fenetre_dilution,dil_pirani,(int)(1000*val_multiplex(pirani)));
+ecritD(fenetre_dilution,dil_pirani,(int)(1000*val_multiplex(blk->ADC_dil[ pirani])));
 
 
@@ -295,9 +321,9 @@
 	ecritT(fenetre_dilution_lecture_brute,fin_f,"dil_switch= %x  \n",blk->switch_dil);
 
-	for(i=0;i<16;i++)	ecritT(fenetre_dilution_lecture_brute,fin_f,"%2d=%6.3f ",i<8?i+11:i+13,val_multiplex(i));
+	for(i=0;i<16;i++)	ecritT(fenetre_dilution_lecture_brute,fin_f,"%2d=%6.3f ",i<8?i+11:i+13,val_multiplex(blk->ADC_dil[ i]));
 	ecritT(fenetre_dilution_lecture_brute,fin_f,"\n");
-	for(i=16;i<32;i++)	ecritT(fenetre_dilution_lecture_brute,fin_f,"%2d=%6.3f ",i<24?i+15:i+17,val_multiplex(i));
+	for(i=16;i<32;i++)	ecritT(fenetre_dilution_lecture_brute,fin_f,"%2d=%6.3f ",i<24?i+15:i+17,val_multiplex(blk->ADC_dil[ i]));
 	ecritT(fenetre_dilution_lecture_brute,fin_f,"\n");
-	for(i=32;i<48;i++)	ecritT(fenetre_dilution_lecture_brute,fin_f,"%2d=%6.3f ",i<40?i+19:i+21,val_multiplex(i));
+	for(i=32;i<48;i++)	ecritT(fenetre_dilution_lecture_brute,fin_f,"%2d=%6.3f ",i<40?i+19:i+21,val_multiplex(blk->ADC_dil[ i]));
 	ecritT(fenetre_dilution_lecture_brute,fin_f,"\n");
 	}
@@ -311,12 +337,12 @@
 //	printf("dilution :  numero de block = %d  \n",numero_block(blk));
 	changecontrole(fenetre_dilution,dil_niveau_helium,idem,idem,idem,idem,calrefcon(0,0,rouge,blanc,blanc),"");
-	y[0]=val_multiplex(j_he1)-calib(dil_j_he1);
-	y[1]=val_multiplex(j_he2)-calib(dil_j_he2);
-	y[2]=val_multiplex(j_he3)-calib(dil_j_he3);
-	y[3]=val_multiplex(j_he4)-calib(dil_j_he4);
-	y[4]=val_multiplex(j_he5)-calib(dil_j_he5);
-	y[5]=val_multiplex(j_he6)-calib(dil_j_he6);
-	y[6]=val_multiplex(j_he7)-calib(dil_j_he7);
-	y[7]=val_multiplex(j_he8)-calib(dil_j_he8);
+	y[0]=val_multiplex(blk->ADC_dil[ j_he1])-calib(dil_j_he1);
+	y[1]=val_multiplex(blk->ADC_dil[ j_he2])-calib(dil_j_he2);
+	y[2]=val_multiplex(blk->ADC_dil[ j_he3])-calib(dil_j_he3);
+	y[3]=val_multiplex(blk->ADC_dil[ j_he4])-calib(dil_j_he4);
+	y[4]=val_multiplex(blk->ADC_dil[ j_he5])-calib(dil_j_he5);
+	y[5]=val_multiplex(blk->ADC_dil[ j_he6])-calib(dil_j_he6);
+	y[6]=val_multiplex(blk->ADC_dil[ j_he7])-calib(dil_j_he7);
+	y[7]=val_multiplex(blk->ADC_dil[ j_he8])-calib(dil_j_he8);
 	if(blk->switch_dil & switch_helium)
 		{
