GetVal vs GetRawVal

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetVal vs GetRawVal

Jump to solution
1,086 Views
pklammer
Contributor II

I am positively immersed in Processor Expert at the moment, so the iron is hot…

What is the difference between GetVal() and GetRawVal() in BitIO (single-bit GPIO)?

And, why can’t I find any documentation of either? I have searched all the PDFs under ProcessorExpert\Help, including :smileyalert: ComponentUserGuides\GPIO_LDD.pdf; there is no mention of GetRawVal anywhere, but there it is in my Components pane, while GetVal is now grayed off (it wasn’t grayed off in some previous experimentation – I don’t know what I did differently now).

I am also still quite fuzzy why my Components Library offers me BitIO, BitIO_LDD, and GPIO_LDD …

Labels (1)
0 Kudos
1 Solution
650 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi Pete!

Generally, GetVal() returns the value of GPIO data register, which is kind of interface between chip’s data bus and pin. This means that this method depends on port/pin data direction: in case of input direction it returns current state of the pin, but in case of output it returns last value written to the data register, not current state of the pin (which might be for example affected by external pull-up).

However, some MCUs supports raw data registers which contains current state of the port/pin (this value is independent from the direction). If it is supported by MCU you use then by using GetRawVal() you can even read the value of the pin which is not used in GPIO function.

Component documentation can be found on Processor Expert help pages – fastest way how to get there is through right-click on component choosing Help on Component in the pop-up menu.

Regarding the grayed off GetVal() method – I guess this is because you have set the Direction property in the BitIO component as ‘Input’ – in such case the method is always generated. You can set the Direction to ‘Input/Output’ to get full control over the method generation.

The GPIO_LDD is more general component which covers whole port and its functionality whereas BitIO_LDD is simpler and focused on single pin and its usage. BitsIO component is available to support migration from projects created before LDD component were introduced. Main difference between previous high-level components (such as BitIO) and LDD ones is that LDD components are OS aware and are designed to make their integration into OS very easy.

Hope this will be helpful.

Lukas

View solution in original post

0 Kudos
3 Replies
651 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi Pete!

Generally, GetVal() returns the value of GPIO data register, which is kind of interface between chip’s data bus and pin. This means that this method depends on port/pin data direction: in case of input direction it returns current state of the pin, but in case of output it returns last value written to the data register, not current state of the pin (which might be for example affected by external pull-up).

However, some MCUs supports raw data registers which contains current state of the port/pin (this value is independent from the direction). If it is supported by MCU you use then by using GetRawVal() you can even read the value of the pin which is not used in GPIO function.

Component documentation can be found on Processor Expert help pages – fastest way how to get there is through right-click on component choosing Help on Component in the pop-up menu.

Regarding the grayed off GetVal() method – I guess this is because you have set the Direction property in the BitIO component as ‘Input’ – in such case the method is always generated. You can set the Direction to ‘Input/Output’ to get full control over the method generation.

The GPIO_LDD is more general component which covers whole port and its functionality whereas BitIO_LDD is simpler and focused on single pin and its usage. BitsIO component is available to support migration from projects created before LDD component were introduced. Main difference between previous high-level components (such as BitIO) and LDD ones is that LDD components are OS aware and are designed to make their integration into OS very easy.

Hope this will be helpful.

Lukas

0 Kudos
650 Views
pklammer
Contributor II

Thanks, Lukas -

I see now that BitIO_LDD got added to my project even though I didn't ask for it when I selected BitIO for a single pin; apparently I thought they were alternatives but actually they are depenedent requirements.

As for GetVal displaying in gray text -- I guess I don't appreciate the significance of gray in this context; I thought it meant the method was somehow unavailable, however dragged it into events.c, and it builds and compiles fine, even though it is still gray?

Keep an eye on this forum -- I have more questions, but will post them under new subject lines; thanks!


0 Kudos
650 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi,

The BitIO component is “first generation” of Processor Expert high-level components available as independent, standalone solution for some older families of Freescale chips (e.g. HCS08/12 or DSC/56800 chips). For new families (mainly ARM-based such as Kinetis or ColdFire+) we provide users with the new LDD components. To support easier migration of applications created for the previous chips we support the “first generation” components for the newer chips, however the LDD component is used as the underlying driver layer. In your case, the BitIO inherits the BitIO_LDD which serves as the interface between BitIO component’s UI/API and hardware; the BitIO is only SW wrapper. We recommend users to use the LDD components as the support of the former ones is intended for migration purposes only.

The gray color generally means that the item is read-only – it doesn’t reflect the availability. It is used to show that item’s value can’t be changed. In case of properties it means that you can’t change their value (e.g. because it is for information only, it is not available for specific mode or its value is required and can’t be changed) and in case of methods it means that the method state (i.e. generate/don’t generate it) is required. Whether the method is generated or not is showed by the green mark or black cross on the method icon in the Components window or by generate code/don’t generate code value in the Component inspector window (in the Methods pane).

Lukas

0 Kudos