You are here

How to switch polarity of IDAC on PSOC 4 | Cypress Semiconductor

How to switch polarity of IDAC on PSOC 4

Summary: 1 Reply, Latest post by repsoc on 24 Sep 2016 02:15 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
j.colmen_1542866's picture
User
2 posts

Hello,

We are using a PSOC 4 CY8C42478ZI-MF485 and we need to switch the polarity of an IDAC using c-code but we can't find the command to do it. Is it possible to do this using software?

Thanks.

repsoc's picture
User
19 posts

You can write your own functions for that.

//palarity 0(Source), 1(Sink)
//IDAC -> component name in this example
void idac_Set_Polarity(uint8 polarity){

    uint8 enableInterrupts;

    /* Set initial configuration */
    enableInterrupts = CyEnterCriticalSection();

    /* clear previous values */
    IDAC_IDAC_POLARITY_CONTROL_REG &=
            (~(uint32)((uint32)IDAC_IDAC_POLARITY_MASK <<
            IDAC_IDAC_POLARITY_POSITION));

    /* set new configuration */
    IDAC_IDAC_POLARITY_CONTROL_REG |=
       ((uint32)polarity << IDAC_IDAC_POLARITY_POSITION);

    CyExitCriticalSection(enableInterrupts);
} 

 

Reiner

 

Log in to post new comments.