MBR3 : Difference between "BUTTON_STAT" and "LATCHED_BUTTON_STAT"

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Dear Sirs and Madams,

 

We are considering using the MBR3 series due to the difficulty of obtaining PSoC4.

 

I understand that sensor information is used by reading the "BUTTON_STAT" register, but when should the "LATCHED_BUTTON_STAT" register be used?

 

Perhaps I thought the "LATCHED_BUTTON_STAT" register was only used for GPIO toggle purposes.

Is there any difference in using it?

 

Regards,

0 Likes
1 Solution
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @MiNe_85951,

If you require the current status of the button and wish to take some actions based on that, you would read BUTTON_STAT. 
In case you require the history of touch on a button (i.e., if a button was ever pressed or not since the last time LATCHED_BUTTON_STAT was cleared), then LATCHED_BUTTON_STAT needs to be read.

 

In short, if the current status of the buttons is required, then use BUTTON_STAT.

 

Regards,
Nikhil

View solution in original post

4 Replies
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @MiNe_85951,

BUTTON_STAT gives the current status of the buttons. And LATCHED_BUTTON_STAT register copies of set bits in BUTTON_STAT since the last time LATCHED_BUTTON_STAT was cleared. The usage of this register would be application specific. For example, if it is required to be known if a button was pressed or not, LATCHED_BUTTON_STAT would hold that data (provided it wasn't cleared).

Regards,
Nikhil

MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Nikhil-san,

 

Thank you for your support.

 

When we check the state of the sensor in general usage, we only need to refer to the "BUTTON_STAT"  register, right?

Or is it better to check and clear the "LATCHED_BUTTON_STAT" register?

 

Regards,

 

 

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @MiNe_85951,

If you require the current status of the button and wish to take some actions based on that, you would read BUTTON_STAT. 
In case you require the history of touch on a button (i.e., if a button was ever pressed or not since the last time LATCHED_BUTTON_STAT was cleared), then LATCHED_BUTTON_STAT needs to be read.

 

In short, if the current status of the buttons is required, then use BUTTON_STAT.

 

Regards,
Nikhil

MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Nikhil-san,

 

I understood how to use them.

Thank you,

0 Likes