Posted 19 Feb 2019 Hi all, I was trying to write some bits to an data register, but when compiling i`ll get an error that there is an type mismatch. The bit "STORING_Netfout" is declared as BIT, see attachement In Schneider Unity there is an function block BIT_AS_WORD to do these things, do GX works2 also have something like this? Share this post Link to post Share on other sites
Posted 19 Feb 2019 You cannot use "MOVE" on a bit. Use ladder or a suitable instruction if needed to trigger bits. Ladder example below: [STORING_Netfout]--(D401.0) You can also specify in GVL these addresses, e.g. define TestDataBit = D401.0: [STORING_Netfout]--(TestDataBit) If you want to batchmove a lot, use "INT_TO_BITARR" instruction. You'll need to create an array of the bits if you are using labels either in local header, or in GVL. Share this post Link to post Share on other sites
Posted 20 Feb 2019 did not touch Mitsubshi in a while but something like this sure used to work: MOV D0 K4M0 MOV K4M0 D0 Share this post Link to post Share on other sites
Posted 20 Feb 2019 Thank you for replying, is there also an function block available for this kind of instruction? Share this post Link to post Share on other sites
Posted 20 Feb 2019 Why use function block when you can use function, or even better -> instruction? If you want the "Schneider-style" function block or function I would recommend you to create a function (FUN), inside it you take 16 bits and use "SET_BIT_OF_INT" to set status to the individual bits in the FUN. THen you can have 16 bit inputs freely selectable and 1 INT output that you can connect to whatever you would like... Share this post Link to post Share on other sites
Posted 20 Feb 2019 (edited) See here for a FB I already made at the request of another poster previously, just import the ASCII to your project. The only difference is it only takes in the lowest 8 bits but you can easily expand this yourself if you need to examine for a value over 255 decimal. Regards Daniel Edited 20 Feb 2019 by collinsd70 Share this post Link to post Share on other sites
Posted 20 Feb 2019 1 hour ago, collinsd70 said: See here for a FB I already made at the request of another poster previously, just import the ASCII to your project. The only difference is it only takes in the lowest 8 bits but you can easily expand this yourself if you need to examine for a value over 255 decimal. Regards Daniel Hi @collinsd70 Thank you, i have started to make my own FUN now indeed. Thank you for helping. Share this post Link to post Share on other sites
Posted 26 Feb 2019 On 20-2-2019 at 8:18 AM, kaare_t said: Why use function block when you can use function, or even better -> instruction? If you want the "Schneider-style" function block or function I would recommend you to create a function (FUN), inside it you take 16 bits and use "SET_BIT_OF_INT" to set status to the individual bits in the FUN. THen you can have 16 bit inputs freely selectable and 1 INT output that you can connect to whatever you would like... Hi @kaare_t, Can you show me how this instruction would look like? I would split the 16 bits from an word to additional bits. D100.0=bit0 D100.1=bit1 ... D100.15=bit15 Regards Share this post Link to post Share on other sites
Posted 26 Feb 2019 Move Word to bit range D100 -> MOV -> K4M0 Will move the content of D100 to boolean bit memory area M0 -> M15. Share this post Link to post Share on other sites
Posted 27 Feb 2019 In GX Works 3 this is quite easy..? Pic attached.. Share this post Link to post Share on other sites