Hello. I must represent real value as 4 bytes. I am doing this as follows:
Real_var AT %MD0: REAL; Word_var AT %MD0: DWORD;
For instance if Real_var=5, then Word_var =16#40A00000. Does someone know more elegant way to doing this?
it depends on what is next step. and yes it works
shooter hat geschrieben: it depends on what is next step. and yes it works
next step is:
Array_of_byte[1]:= WORD_TO_BYTE(Word_var); Array_of_byte[2]:= WORD_TO_BYTE(SHR(Word_var,8)); Array_of_byte[3]:= WORD_TO_BYTE(SHR(Word_var,16)); Array_of_byte[4]:= WORD_TO_BYTE(SHR(Word_var,24)); CANOPEN_SDOWRITE_real( EXECUTE:= execute, CHANNEL:= 1, NODE:= slave_node, IDX:= index, SUBIDX:= subindex, LEN:= 4, DATA:= Array_of_byte, Timeout:= t#200ms, RESULT=> );
check oscat.de he made special communication functions. also for canopen
Log in to post a comment.
Hello. I must represent real value as 4 bytes. I am doing this as follows:
For instance if Real_var=5, then Word_var =16#40A00000.
Does someone know more elegant way to doing this?
it depends on what is next step. and yes it works
next step is:
check oscat.de he made special communication functions.
also for canopen