Analog and digital output pin Per-Pin API

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

cross mob
AlVa_264671
Level 5
Level 5
25 sign-ins First like given First like received

I'm trying to figure it out how to use per-pin Api to set alternatively the pin component showed

in attached pic, between open drain  drive low   and high impedance analog.

I'm using   CyPins_SetPinDriveMode(CYREG_PRT0_PC5,PIN_DM_OD_LO );  

and   CyPins_SetPinDriveMode(CYREG_PRT0_PC5, PIN_DM_ALG_HIZ);  with no success.

I would need  to measures   the R_1 voltage drop with the DeltaSigma adc.

This is just one cell of the circuit I'm trying to implement.

The final circuit is gonna need to measure  4 resistor sequentially using  a Amux  to connect to ADC, the pot R_2 is manually operated.

That's the reason to switch between Analog high impedance and  open drain , drive low.

I cannot achieve hook up  the R_1 and  and ADC negative input to Vssa with the  pin component.

Schematic.pngPin Config.png

Thank you for some help.

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Alejandro,

I tried code you are using at my end. I could see the drive modes changing.

    for(;;)

    {

        CyPins_SetPinDriveMode(CYREG_PRT0_PC5,PIN_DM_OD_LO ); 

        CyDelay(5000);

        CyPins_SetPinDriveMode(CYREG_PRT0_PC5, PIN_DM_ALG_HIZ);

        CyDelay(5000);

}

pastedImage_3.png

and could see the output changing for pin pulled up using a resistor.

Best Regards,
Vasanth

View solution in original post

0 Likes
4 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

AIVa,

I would do it differently. Keep in mind that pin_1 has input resistance ~100 oHm, which will affect measurement.

Voltage should be measured by ADC directly on R_1 using two analog input pins. A separate pin should connect R_1 to the ground. Set this extra Pin_4 to 'digital, open drain drives low'.

Command Pin_4_Write(1); will set it to GND. Command Pin_4_Write(0); will set it to Hi-Z .

Use AMUX to switch between resistors. No pins re-assignment in code is necessary.

/odissey1

Thank you for your suggestion, yes, I can do that way.

But you or someone else can explain the way I asked for?

Reason: I remove form my project the function that was working OK, and to ease the test for other functions and  I paste it in .txt file and save it in created folder. This happened 3 moth ago. This week I put back the function and it did not work.  That way worked OK for my app.

Thank you.

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Alejandro,

I tried code you are using at my end. I could see the drive modes changing.

    for(;;)

    {

        CyPins_SetPinDriveMode(CYREG_PRT0_PC5,PIN_DM_OD_LO ); 

        CyDelay(5000);

        CyPins_SetPinDriveMode(CYREG_PRT0_PC5, PIN_DM_ALG_HIZ);

        CyDelay(5000);

}

pastedImage_3.png

and could see the output changing for pin pulled up using a resistor.

Best Regards,
Vasanth

0 Likes

Thank you VasanthR_91

Yes, I'm doing that.

Regards

0 Likes