Re:Based on ADC value i am trying to on /off Relays

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.
Not applicable
Hi,

As i am doing a project in which i am interfacing current transformer to ADC channel of xmc1100,in that i am Supposed to use 8-bit ADC ,and reference voltage is upper voltage range of controller ,i am using XMC1100 ARDUNIO board ,Based on the value given by ADC i supposed to on/off Relays,i am Keeping some voltage value as reference eg:2V ,if reference voltage is less than <2V Relay1 should be on,If reference voltage>2V Relay2 should on.please suggest me what are the Required configurations i supposed to do for ADC_004 &IO004 or any other Apps i supposed to use to control relays?.Currently i am using IO004 APP for relays.i have read the Help contents little confusion is their please suggest me.Pins as per datasheet i am using P0.4 GPIO for relay1,P0.12 GPIO fo r relay2, P2.6 AA for ADC Channel.please suggest me.What are the APPS to be used and how to configure,I tried on/off LED'S based on some reference values its working well .Is that same configuration work for Relays also or i should change anything.
This is the code please find the attachment
0 Likes
3 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi prathibha,

There are many ADC examples from the below link.

http://www.infineon.com/cms/en/product/promopages/aim-mc/dave_downloads.html
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi
I am working on xmc1200 evolution board,ADC001 app i am using ,Reference voltage of ADC is 5v.12-bit ADC I am using
As i am trying to on/off Relays based on ADC voltage value i am using threshold value 1.26V(1032) if count,if(count<1032) relay1 is to be on,Relay2 to be off ,and count if >1032 Relay2 be to on and relay1 to be off.when i am using the this function in interrupt service routine(ISR) its working well but the same function when i am using in main while() loop its not on/off the relays based on threshold voltage,Defaultly Both the relays are on,ADC clock i have set for 125KHz.please suggest me how i can make to run relays in main while() loop,instead of ISR.please find the attachment,Kindly suggest me how i can on/off relays in main while() loop.
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
prathibha wrote:
Hi
I am working on xmc1200 evolution board,ADC001 app i am using ,Reference voltage of ADC is 5v.12-bit ADC I am using
As i am trying to on/off Relays based on ADC voltage value i am using threshold value 1.26V(1032) if count,if(count<1032) relay1 is to be on,Relay2 to be off ,and count if >1032 Relay2 be to on and relay1 to be off.when i am using the this function in interrupt service routine(ISR) its working well but the same function when i am using in main while() loop its not on/off the relays based on threshold voltage,Defaultly Both the relays are on,ADC clock i have set for 125KHz.please suggest me how i can make to run relays in main while() loop,instead of ISR.please find the attachment,Kindly suggest me how i can on/off relays in main while() loop.


Put a breakpoint at "if(Result.Result<1032 )" and step thu the software to understand why it does not get into the conditions you had set. What is the value of the Result.Result?
0 Likes