help coding 16 capsense buttons

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

cross mob
Anonymous
Not applicable

Hello all,

   

I am trying to configure 16 Capsense buttons with PSoC 1 device CY8C20534. I have coded for 1 byte i.e. 8 buttons & now I wish to go for a WORD count.

   

So please tell me what changes do I need to do while defining the "I2C register structure" in Main.c & configuring the "buttonstate" variable for a WORD of Buttons in display.c?

   

I tried to do it but getting lot of errors.

   

Please give me any sample code for the Buttons count of a WORD. Also suggest if there are any on cypress's site.

   

Awaits for the positive responce.

   

Thanks & Regards-

   

Amit

0 Likes
11 Replies
lock attach
Attachments are accessible only for community members.
bharadhwajas_91
Employee
Employee
First like received First like given

Amit, 

   

Please find attached  project as requested.

   

 

   

Bharadhwaj

0 Likes
Anonymous
Not applicable

Hello Bharadhwaj,

   

Greetings...

   

Thanks for the reply.

   

Regards-

   

Amit

0 Likes
Anonymous
Not applicable
        Hello all, Please help regarding the status holding of the sensors when power failure takes place. Suppose I have turned ON sensor 1&2 before power failure. Now when power return's I wish to have them ON only. That is, I don't want them to reset when power is taken off & then returned. How can I retain their state, please guide to make things work. Thanks& Regards- Amit   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Only eeprom can survive a power fail. So you might use eeprom to store the current state of your machine.

   

 

   

Bob

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

Hello Bob,
Attached is the working project for PSoC 1. Please have a look & suggest me changes to get the feature addes in this project.
Thanks & Regards-
Amit

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Amit, since I do not know what exactly you want to do (and it would be too complicated for me to learn that) just do

   

Place a E2Prom component (it is pure software) set Block number to 127 (that is upmost flash block) size = 64 Bytes.

   

Now you can save up to 64 bytes of data within your chip.

   

Open the E2Prom's datasheet and look at the APIs and the examples, try them and adapt it to your needs.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hey Bob,

   

I am developing a switchboard for my home, replacing the mechanical buttons & slider to the fan regulator.

   

For the same I've developed the same for the buttons only. With this I have a board made & on that i have taken a trial.

   

The switching operation works fine, but the problem I face is when power is failed the all gets to off state & when power returns I need to again go & touch the switches to turn them ON.

   

I wish that the switches TURNED ON before power fail should auto. be turned on at resume as in case of mechanical switches.

   

Help with same. The Project is attached, you can have it & tell the changes to get E2PROM feature embedded.

   

For the same, If I need also suggest any IC's that you will recommend for the E2PROM or will it be configured within PSoC only.

   

Thanks & Regards-

   

Amit

0 Likes
Anonymous
Not applicable

Hey Bob,

   

I am developing a switchboard for my home, replacing the mechanical buttons & slider to the fan regulator.

   

For the same I've developed the same for the buttons only. With this I have a board made & on that i have taken a trial.

   

The switching operation works fine, but the problem I face is when power is failed the all gets to off state & when power returns I need to again go & touch the switches to turn them ON.

   

I wish that the switches TURNED ON before power fail should auto. be turned on at resume as in case of mechanical switches.

   

Help with same. The Project is attached, you can have it & tell the changes to get E2PROM feature embedded.

   

For the same, If I need also suggest any IC's that you will recommend for the E2PROM or will it be configured within PSoC only.

   

Thanks & Regards-

   

Amit

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I will not do the programming for you. This you will have to overcome yourself. Do as I suggested on the last post and see what you get done. Are you still using PSoC1 and not yet PSoC4? A complete PSoC4 prototyping Kit with debugging capabilities is available for very few money. Look at the CY8CLIT-043.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hey Bob, Greetings.

   

I have CY8CKIT-042 with me. I'm doing my next project over it only.

   

But as I have it working with PSoC 1, I want to have it fulfilled with PSoC 1 only. For the same I have gone through the references for E2PROM, as you suggested. For that, I dont need any extra H/W so it again encourage me to get the PSoC 1 with status holding capabilities. So I'm trying for the same.

   

Now the question is how to find, How many blocks will be needed for this task to change their permissions in FLASHSECURITY.txt file?

   

How would be the current status of switches will be written to the E2PROM & will be written back to RAM on power resume.

   

Will the calling API's E2PROM_bE2Write() & E2PROM_E2Read() will be enough?

   

Is the wAddr = 1st  Addr block whose Permissions I have changed?

   

Will be waiting for the clarification.

   

Thanks & Regards-

   

Amit

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

PSoC 4 has got no EEProm, but there is a component named emEEProm which stands for "emulated EEProm"

   

It works by using flash memory instead of "real" eeprom. You did not yet have a look at the emeeprom's datasheet, or you would have noticed that the APIs are named a bit different from PSoC1. Easiest Solution for your case would be for you to

   

const uint8 SavedSwitches[12] = {0}; // this will be in flash

   

uint8 RamSwitches[12];

   

 

   

memcpy(RamSwitches,SavedSwitches,12);   // Load actual switches with data

   

and

   

Em_EEPROM_Write (RamSwitches,SavedSwitches,12); // Write switch states to flash. Take care, will take some ms

   

Let the flash security to "U" unprotected for the complete chip.

   

 

   

Bob

0 Likes