Personality
16 Jun 2016 11:37 #76149
by BigJohnT
Personality was created by BigJohnT
The halcompile has a personality option. The man page has nothing about it and the manual only has one short paragraph with no examples. Anyone have an example of using personality so I can update the manual?
JT
JT
Please Log in or Create an account to join the conversation.
16 Jun 2016 11:53 #76153
by andypugh
Replied by andypugh on topic Personality
The last example has an example of use.
Basically the "personality" number is passed to each component as a variable that can be used for various purposes.
It is "visible" to the system at pin-creation time, so can be used to control which pins are created, or their number.
bitslice uses it in a very basic way, to control the pin count:
github.com/LinuxCNC/linuxcnc/blob/2957cc...onents/bitslice.comp
bldc miss-uses it horribly to do more subtle things
github.com/LinuxCNC/linuxcnc/blob/2957cc...components/bldc.comp
In this case the personality numbers are actually created by the EXTRA_SETUP function, and used as a way to pass a parameter to the pin-creation code. That probably should not be a documented usage, but you can also see in that .comp how to use personality to optionally create pins on the basis of logical tests.
It would probably be better to create a second flag that can be set in EXTRA_SETUP and used in the pin creation section without the confusing auto-documentation of personality.
Basically the "personality" number is passed to each component as a variable that can be used for various purposes.
It is "visible" to the system at pin-creation time, so can be used to control which pins are created, or their number.
bitslice uses it in a very basic way, to control the pin count:
github.com/LinuxCNC/linuxcnc/blob/2957cc...onents/bitslice.comp
bldc miss-uses it horribly to do more subtle things
github.com/LinuxCNC/linuxcnc/blob/2957cc...components/bldc.comp
In this case the personality numbers are actually created by the EXTRA_SETUP function, and used as a way to pass a parameter to the pin-creation code. That probably should not be a documented usage, but you can also see in that .comp how to use personality to optionally create pins on the basis of logical tests.
It would probably be better to create a second flag that can be set in EXTRA_SETUP and used in the pin creation section without the confusing auto-documentation of personality.
Please Log in or Create an account to join the conversation.
16 Jun 2016 12:19 #76156
by BigJohnT
Replied by BigJohnT on topic Personality
Thanks so much for the example.
In the bitslice component I'm guessing the following line of code meansout-##[32:personality]; translates to substitute ## with 32 or personality if present?
JT
In the bitslice component I'm guessing the following line of code means
pin out bit out-##[32:personality];
JT
Please Log in or Create an account to join the conversation.
16 Jun 2016 12:26 #76158
by andypugh
Replied by andypugh on topic Personality
# (or ##, or ###) is a placeholder in the pin name for the index number. [32:personality] means that there can be between 1 and 32 pins, and the number is set by personality.
You can,if you need to use things like
type-one-pin-## [32:(personality&0x0F)]
type-two-pin-## [32:(personality&0xF0 >> 8)]
if you need to encode more data in the personality parameter.
You can,if you need to use things like
type-one-pin-## [32:(personality&0x0F)]
type-two-pin-## [32:(personality&0xF0 >> 8)]
if you need to encode more data in the personality parameter.
The following user(s) said Thank You: BigJohnT
Please Log in or Create an account to join the conversation.
19 Jun 2016 10:46 #76276
by BigJohnT
Replied by BigJohnT on topic Personality
What does the &0x0F and &0xF0 >> 8 do? I know that 0x0F is hexadecimal for 0000 1111 and 0xF0 is hex for 1111 0000 and >> is bit shift right but I'm clueless how to use that with personality. Sorry about my ignorance but C is a bit of a stretch for me.
Thanks
JT
Thanks
JT
Please Log in or Create an account to join the conversation.
19 Jun 2016 10:59 #76279
by andypugh
Replied by andypugh on topic Personality
It's just a way to store two smaller numbers or a set of option flags inside the one big number that you are allowed to pass as a personality.
Please Log in or Create an account to join the conversation.
Time to create page: 0.176 seconds