Current DAC component with hardware direction control

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

cross mob
Anonymous
Not applicable

I'm using current DAC in my project. The direction is to be changed upon change in comparator's output.

   

 

   

How can the component be changed to get a terminal for doing the same?

   

 

   

Right now I'm using Interrupt to change the direction. But using hardware terminal for doing it will be appreciated.

   

 

   

Please help.

   

 

   

-David

0 Likes
1 Solution
Anonymous
Not applicable

Hi David,

   

 

   

It is possible to modify a component and create a custom component.

   

 

   

The VIDAC Block available in PSoC has provision for changing the direction of current (Polarity) in hardware.

   

To do this, you need to:

   

1) Create a PSoC Library as shown below.

   

   

 

   

 

   

2) Then you must import the component which you intend to modify (in this case IDAC Component).

   

 

   

   

 

   

3) Select IDAC8 from CyComponentLibrary.

   

 

   

4) Now the IDAC component will be imported. In the schematic, idir (direction) terminal is connected to low. If this has to be available as an external terminal, then connect a "Digital Input Terminal" to it.

   

 

   

View solution in original post

0 Likes
8 Replies
Anonymous
Not applicable

Hi David,

   

 

   

It is possible to modify a component and create a custom component.

   

 

   

The VIDAC Block available in PSoC has provision for changing the direction of current (Polarity) in hardware.

   

To do this, you need to:

   

1) Create a PSoC Library as shown below.

   

   

 

   

 

   

2) Then you must import the component which you intend to modify (in this case IDAC Component).

   

 

   

   

 

   

3) Select IDAC8 from CyComponentLibrary.

   

 

   

4) Now the IDAC component will be imported. In the schematic, idir (direction) terminal is connected to low. If this has to be available as an external terminal, then connect a "Digital Input Terminal" to it.

   

 

   

0 Likes
Anonymous
Not applicable

   

 

   

5) The IDAC.c file should be modified so that the direction can be changed in hardware.

   

6) Save the component. Dependancy can be added to this library and the component can be used in any project.

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

The modified IDAC Component library is attached.

   

 

   

Dependency can be added to this library and IDAC component with hardware direction control can be used.

Anonymous
Not applicable

thank u

0 Likes
KannanS_06
Employee
Employee
First like received

Hey

   

This is interesting information. I believe cypress has to think on providing such useful custom components in a repository somewhere in thier website or this forum.

   

-Archie

0 Likes
Anonymous
Not applicable
        Good stuff! ...A neat hack 🙂   
0 Likes
Anonymous
Not applicable

Hi David Ron,

   

 

   

Another important aspect to be considered is the calibration of the IDAC.

   

Every DAC has DAC Trim Register (DACx_TR) which has an 8-bit value to increase or decrease the gain. This will be different for a given IDAC when it is operating in source or in sink mode.

   

Hence, the user should take care of this value when the IDAC direction mode is changed during run time.

   

A sample Calibration routine does the following:

   

Its goal is to adjust the calibration code to get 256uA from the IDAC when the input code is 255 in the mid-range:

   

1) Fix the digital input code to 255 and the calibration code to 128 (128 = 0b10000000 is the default value)

   

 and capture the DAC output.

   

2) Determine the gain error.

   

3) Apply the correct calibration code and capture the DAC output.

   

 

   

The default value of the Cal[7:0]  is [10000000]. Values lower than this will decrease the gain and values greater than this will increase it.

   

For more information, refer to the Technical Reference Manual (TRM).

0 Likes
Anonymous
Not applicable

This means that when you switch between a sourcing mode and sinking mode IDAC you will need to change the trim settings else the gain settings for the IDAC in the sourcing mode and sinking mode would not be identical. But when the switching is happening in hardware this might be tough to do since the hardware switcing signal would then have to trigger an interrupt to rewrite the trim register and it obviously takes out the advantage of having a hardware control for IDAC sourcing and sinking

   

But there is something that we could do to avoid this. If there is an application that requires a hardware polarity control for the IDAC then a new teim would have to be determined for the design. This could be done by treating the IDAC as a 9-bit DAC with the polarity as the MSB and trimming accordingly. Now we have to understand this trim would be different in different devices. Hence this trim would have to be a routine that uses the DelSig ADC and does a runtime trim.

   

I am not sure about this but in most applications I am sure we might be able to find a relationship for the trim based on the corresponding trims of the sourcing and sinking side...

0 Likes