src/sync.c
changeset 204 44ce74232ccb
parent 201 2966cd34162a
child 208 05d95c45b388
--- a/src/sync.c	Fri May 25 15:48:34 2007 +0200
+++ b/src/sync.c	Fri May 25 23:57:17 2007 +0200
@@ -183,16 +183,17 @@
 	status = state9;
     
     case state9:	/* get data to transmit */ 
-      index = (UNS16)((*pMappingParameter) >> 16);
-      subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF);
+	{
 	  UNS8 ByteSize;
 	  UNS8 tmp[]= {0,0,0,0,0,0,0,0};
+	  index = (UNS16)((*pMappingParameter) >> 16);
+          subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF);
 	  Size = (UNS8)(*pMappingParameter); /* Size in bits */
 	  ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => 2, ... */
 	  objDict = getODentry(d, index, subIndex, tmp, &ByteSize, &dataType, 0 );
 	  /* copy bit per bit in little endian*/
 	  CopyBits(Size, ((UNS8*)tmp), 0 , 0, (UNS8*)&d->process_var.data[offset>>3], offset%8, 0);
-	    
+	}   
         if( objDict != OD_SUCCESSFUL ){
           MSG_ERR(0x1013, " Couldn't find mapped variable at index-subindex-size : ", (UNS16)(*pMappingParameter));
           return 0xFF;