PSoC 4 Sar Mux, SampleValues differ from RealValues

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

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

Hi,

   

I am new to this forum, and thought i would give it a go.

   

I have a problem with the Sar multiplexer on PSoC 4. The problem is that it doesnt log the actual values that i can meassure with a voltmeter. In addition, i am sampling on all 8 channels, and the offset from RealValues to SampledValues is different on each channel.

   

I think it might be problem with the setup of the SarMux.

   

Can anyone offer some insight? Something i havent thought about?

   

 

   

Note: The project is based on an SD-card example, and i have added an lcd-screen as well. Comments in code are in danish.

   

Purpose: The purpose of my prototype is to meassure the increase of resistance in a wire, after each bend. The PowerRelay bends the wire from side to side, and i sample each X'th cycle. I made a voltage divider to where i am meassuring the voltage after the wire i am testing, and before a 1K_ohm resistor. With Ohms law i should be able to determine the resistance of the wire by meassuring the voltage between the "two" resistors.

   

SampleValues:

   

Cycle: 0 Data: 4424, 4468, 4, 4468, 2240, 4071, 1405, 4468,
Cycle: 4 Data: 4457, 4466, 1161, 4466, 3126, 4426, 2515, 4463,
Cycle: 8 Data: 4457, 4466, 1191, 4466, 3176, 4428, 2544, 4463,
Cycle: 12 Data: 4455, 4466, 1193, 4466, 3130, 4426, 2504, 4463,
Cycle: 16 Data: 4457, 4466, 1025, 4466, 3246, 4428, 2511, 4461,
Cycle: 20 Data: 4457, 4466, 1178, 4466, 3109, 4424, 2526, 4463,
Cycle: 24 Data: 4457, 4466, 1047, 4466, 3248, 4428, 2493, 4461,

   

(samples in cycle 0 is the aim, and for this óne instance, was meassured correctly)

0 Likes
2 Replies
EmHo_296241
Level 5
Level 5
10 solutions authored 50 replies posted 25 replies posted

Hi,

I have doubts about the usage of ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) statement. I am expecting that it won't be necessary here.  And even though limit detection is specified, it is not enabled in any of the channels in the ADC channel configuration window. I think that is causing the problem. If you do both these corrections, you will get correct result I guess.

0 Likes
Anonymous
Not applicable

Hi Embedd Holmes.

Thank you for the reply. You were partly right. The ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) statement wasnt necessary at all. I read some post i could find around the forum and decided to try and see if it would work. but it had no effect as far as i can tell.
 

   

But I did manage to solve the problem. I was supplying voltage to the PSoC 4 through the Vin and GND at the J1 headers. I switched and tried to supply voltage trough P5_VDD and the corresponding GND of this header aswell. This solved the problem.

   

As far as i know, this new header is responsible for the communication to the PSoC 5 that boots the PSoC 4. Therefore the voltage regulators is connected differently here, than on the Vin/Gnd in header J1 and i get a correct reference value. The problem was that the compare-value was incorrect, which resulted in af faulty measurement.

   

 

   

The program is running smoothly, and is working fine. Thank you again for the suggestion.

   

 

   

/Casper

0 Likes