Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
I am working with UINT variables, but I would like to map then bit by bit because each bit has a determinate meaning. I am trying to do it following the help menu but I cannot do it. Can anybody help me please?
If I have understood properly I should make an structure of 16 bits and then try to map it, but I do not know how to map it bit by bit
Thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Add a variable in the mapping table like wFaultRegister.
In the code you can access the bit level of the variable as follows:
OverTemperatureΒ :=wFaultRegister.0;Β Β (* Get bit0, all bits are accessed 0 based *)UnderTemperature :=wFaultRegister.1;(*Youcangetcreativeandsubstitutethebitsbyenumerationsandconstants*)ENUM_OVRTEMPΒ :=0;Β Β (* Assume this is part of an enum structure *)ENUM_UNDRTEMP :=1;OverTemperatureΒ :=wFaultRegister.ENUM_OVRTEMPΒ ;UnderTemperature :=wFaultRegister.ENUM_UNDRTEMP;AlsoeasytocreateyourownFBtodothissimilartotheUNPACKFB.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks spfeif for the info but I would like to use this in a mapping input/output card.
I mean instead of mapping a UINT variable in a %QW0, I would like to map bit by bit like %QB0.0,%QB0.1, %QB0.2...and so on. I have seen on the help menu that is possible but I do not know how to do it
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe it is not possible. I am assuming what you are calling mapping is from the IO of the target. the target is not configurable. Why does it matter? Just map in the software?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good afternoon,
I am working with UINT variables, but I would like to map then bit by bit because each bit has a determinate meaning. I am trying to do it following the help menu but I cannot do it. Can anybody help me please?
If I have understood properly I should make an structure of 16 bits and then try to map it, but I do not know how to map it bit by bit
Thanks in advance
Add a variable in the mapping table like wFaultRegister.
In the code you can access the bit level of the variable as follows:
Thanks spfeif for the info but I would like to use this in a mapping input/output card.
I mean instead of mapping a UINT variable in a %QW0, I would like to map bit by bit like %QB0.0,%QB0.1, %QB0.2...and so on. I have seen on the help menu that is possible but I do not know how to do it
I believe it is not possible. I am assuming what you are calling mapping is from the IO of the target. the target is not configurable. Why does it matter? Just map in the software?