Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Setting a bit

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Setting a bit
Moderator:
JFMD

Post Reply
Follow this topic



Setting a bit

supton posted on 25 Mar 2011 10:42 AM PST
Senior Member
15 Forum Posts

I wanted software control over a bit (just goes to the LED, on the CY8CKIT-001).  I see in the .c file for the pin/port a "write" command ("LED_Write(uint8 value)"--I called the pin "LED", as all I wanted to do was to flip the LED off and on).  However, if I try to build with just a pin in the TopDesign.cysch, I get errors.  So I put on a ControlRegister, and put the pin onto that.

I sorta get this, sorta don't: if I do a build, and get the errors, I see the command to write to the pin, which makes me think I should be able to do a direct write.  Then again, I can see why I would need to go through a control register--it would represent a physical location for the code to access, a layer or firewall if you will.  Or am I missing something--can I write directly to the pin, w/o the ControlRegister?

Shawn




Re: Setting a bit

Robert-CY posted on 29 Mar 2011 05:19 PM PST
Cypress Employee
129 Forum Posts

Shawn,

I am not quite sure I understand your question but I will give it a shot. You can write to a bit any time as long as it is actually just a bit in memory. If the "bit" is actually a port pin it is different. The port pin has the options of being an input or an output, you need to make that disctinction. As an output it can still be in different modes such as open drain or Push/Pull, another decision for you to make... That's why you need to control a pin with a control register. For a bit in memory there is no such need. Did I get your question right?

Robert



Re: Setting a bit

supton posted on 30 Mar 2011 09:03 AM PST
Senior Member
15 Forum Posts

Close enough for me.  I saw the write command, and thought it might be more simple than using a Control_Register.  Simple enough to use one of those, especially once I get these sheet connector symbols working.

Thanks.

Shawn



Re: Setting a bit

JJHawg posted on 08 May 2011 09:51 PM PST
Senior Member
11 Forum Posts

I have been dealing with a similar issue, and found that unchecking "HW Connection" on the pin configuration dialog will allow me to place a pin with nothing internal connected to it, and let me use the read and write functions on it.

There is a PSoC attribute that still hasn't sunk in for me yet. Even though you can patch various internal signals to any I/O pin that you want, these pins are still associated with an 8-bit port. I suppose the value of using a control register (instead of writing directly to a port pin) is that you could map a 4-bit control register to any 4 pins of choice, not necessarily on the same port. HOWEVER, if you look at the API code for this there is probably a bunch of bit-twiddling, masks and shifts going on, so it isn't "free." Even writing directly to the pin will create the same API code that you would need to write yourself to control a single bit of an 8-bit port.

I hope this is helpful... Jim






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20