Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > C Syntax for PSOC Creator

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



C Syntax for PSOC Creator
Moderator:
JFMD

Post Reply
Follow this topic



C Syntax for PSOC Creator

Dietschi posted on 15 Mar 2011 2:10 PM PST

1 Forum Post

Hi there

It's long time ago that I programmed some C code. So the C Syntaxes are gone out of my brain:)

I searched I the whole PSOC Creator and Keil help, but I couldn't find an help or lookup table for the basic C Syntaxes. ex. how to perform a logic shift of a Varliable, Array handling, Pointer initializing...

Does sombody know where I can find these?

Best regards

Fabian




Re: C Syntax for PSOC Creator

Robert-CY posted on 16 Mar 2011 10:25 PM PST
Cypress Employee
129 Forum Posts

Hi Fabian,

you asked about C-Syntax for PSoC Creator. There is no specific C-Synthax for Creator, just C-Syntax in general.

There are API calls though and they are listed in the data sheet of every component. These calls and how to pass parameters follow the same standard C-Syntax.

As for a good C-Book, that is highly depending on personal liking.

I posted this a couple weeks ago but it makes for a good reference you can use as well.

"The C programming language by Kernighan / Ritchie" is old but still a reference.

"Embedded C-programming by Michael J. Pont" comes to mind.

Have fun developing with PSoC and Creator!

Robert



Re: C Syntax for PSOC Creator

ceena posted on 14 Sep 2011 11:11 PM PST
Member
2 Forum Posts

Hello,

It looks like syntax that we use in general for embedded C programming has errors in PSoC Creator.

e.g.

ADC_Output = (BYTE)(F_ADC_Output>>2);

error : BYTE is unidentified identifier.

This was good in designer; can anyone help me out with this ?



Re: C Syntax for PSOC Creator

Alan Hawse posted on 15 Sep 2011 11:52 AM PST
Cypress Employee
1 Forum Post

Ceena,

You section of code: 

ADC_Output = (BYTE)(F_ADC_Output>>2);

 

error : BYTE is unidentified identifier.

 

The (BYTE) is a C Cast operation that casts the (F_ADC...) to a type of BYTE

 

In the designer include files there is a #define which causes BYTE to be a shortcut to an 8bit c type.

 

In creator you can use the type of uint8... which is also a #define to a native C-type of an 8bit unsigned integer.

 

Your code could be

 

ADC_Output = (uint8)(F_ADC_Output>>2);

 

 

This wikipedia page is a good reference for the c-programming language

http://en.wikipedia.org/wiki/C_syntax

 

Alan



Re: C Syntax for PSOC Creator

ceena posted on 19 Sep 2011 11:21 PM PST
Member
2 Forum Posts

 Thanks Alan . . . 






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