no. of buttons possible with 8-bit uC

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

cross mob
Anonymous
Not applicable

Hello all,

   

Greetings for the day.

   

       I'm working with the PSoC 1, device CY8C20x34-12

   

It is a 8-bit micro-controller, I have configured 8 Buttons (+8 LED's) using this uC; my question is Can I configure more than 8 Buttons using this uC.

   

it has 28 I/O's, 7required for (4- 2VDD, VSS, XRES & 3- 2EzI2Cs, Extr. Cap) & remaining available.

   

If it is possible please guide me on it, also if you have some sample codes for it do forward.

   

Thanks & Regards-

   

Amit

0 Likes
9 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Using a ssop 20634 seems like tool indicates 27 pins can be capsense....

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thanks Dana,

   

Did you mean 17/21?

   

I mean how can I get 27 pins as capsense when

   

4 out of 28 aren't accessable & another 3 are used for the Std. functions like EzI2Cs.

   

Another thing is If  I can get a sample code for the 8+ Butoons I will have a brief idea how to assign the pins addresses for working of 8+ buttons.

   

Any random code configured for 8+ buttons will help.

   

Thanks & Regards-

   

Amit

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Unless you make buttons dual function if the package does not

   

have enough pins then you need to use a different device/package

   

to get the amount of buttons you want.

   

 

   

It may be possible to time mux things like I2C and Capsense

   

but the complexity that brings to coding/debugging vs just get enough

   

pins on a package I would think latter best path to design success.

   

 

   

There is another approach where you use a pin, tie a multi R voltage divider

   

to the pin with buttons wired to ground and an A/D looking at pin. You can

   

cram quite a few buttons on a pin using this approach, you have to do a DC

   

analysis to determine how many based on switch R and resistor tolerance

   

and A/D accuracy.....

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hello Dana & Bob,

   

I have code for working 8 buttons with Device CY8C20x34, now I am trying to increase the count to 16.

   

To do this what will be the changes I will have to do in my code?

   

I am trying it by defining 2 functions separately for the 2 packs of 8 buttons viz

   

BYTE bButtonState_0 &  BYTE bButtonState_1 ; considering 8-bit controller thought of defining separate function for each 8 buttons.

   

in accordance to this here are the changes I made in the code files :-

   

Display.c file :-

   

          void Capsense_DisplaySensorState(BYTE bButtonState)
               {
                     void Capsense_DisplayButtonState(BYTE bButtonState_0, BYTE bButtonState_1);
               }

   

Main.c

   

           struct I2C_Regs
              {
                   BYTE bSensorIndex;
                   WORD wSensorRawCount;
                   WORD wSensorBaseline;
                   WORD wSensorDiffCount;
                   BYTE bButtonState_0;
                   BYTE bButtonState_1;
            } MyI2C_regs;

   

        //display button state
                         Capsense_DisplayButtonState(CSA_EMC_baSnsOnMask[0], CSA_EMC_baSnsOnMask[1]);

   

I wish to know if I'm going on right track or not? Guide on it.

   

Any ref. code for 8+ buttons will help, please share if you have one.

   

Thanks & Regards-

   

Amit

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Fron Capsense deisgn guide -

   

 

   

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This ap note obsolete, not sure why, but cannot find project.

   

 

   

www.cypress.com/

   

 

   

You could file a CASE to see if you can get project to examine.

   

 

   

    

   

          

   

To create a technical or issue case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello Dana & Bob,

   

Greetings!

   

1.       I wish to implement 16 sensors on my device with PSoC 1 CY8C20534.

   

With that I'm using it for the 8 buttons currently, by unlocking the pins assigned to LED's I can get around 20-21 pins to configure as inputs.

   

I have tried to do it & I have done it for the 10 inputs (build ok), project for the same is attached; please check if I'm going write or not & tell me the modifications for the same to get it to 16.

   

2.         Can I get more than 16 buttons? what will be the changes for that? Defining " BYTE bButtonState_2 " ?

   

3.        Can I use DPDT switches to turn the desired appliance & corresponding LED with single Capsense Button? Currently I'm using SPDT one each for the appliance & LED Corrsp.

   

Also tell me if any simple & better way to do it. Please guide.

   

Thanks & Regards-

   

Amit

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This can save pins with the following limitations -

   

 

   

1) LEDs must have low Vth

   

2) LEDs, when both on, wll have lower brightness then when

   

only one on.

   

3) You can turn on either LED with a 0 or one to pin , or both if pin

   

tristated.

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hello Dana,

   

Greetings for the day.

   

Now I'm trying to get 16 Buttons by removing/un-locking all the pins assigned to LED's (availabel =~21 pins).

   

To do this i.e. moving to Word from a Byte what are the changes I need to understand? Can you give  me any sample code for the word length without implementing LED's?

   

Do I need to define two variables BYTE bButtonstate_0 & BYTE bButtonstate_1 for two Bytes or with WORD wButtonstate will do the job?

   

Also tell about modifying other variable from byte to word & if any sample code to refer.

   

Is the index register a Byte or a Word?

   

Thanks & Regards-

   

Amit

0 Likes