Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

c programming source code for how to enable and disable a particular switch?

Status
Not open for further replies.

vairamathi

Newbie level 6
Joined
Dec 20, 2011
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,364
can anyone send me embedded c program for how to enable and disable a particular switch
 

from C you can do that but you need to have some hardware .....what hardware ( processor ) or board that your are using ?
 

And what switch would that be?
 

You can enable and disable a switch (using relay ) .
but here you dont need embedded c .
it is simple c programming .the circuits can be controlled by your PC's parallel or serial port
If you want to do it by using embedded system you will specify which controller you are using
 

i m using AVR ATmega32 microcontroller

---------- Post added at 06:22 ---------- Previous post was at 06:20 ----------

i m using start,stop,auto/manual,time/up,time/down switch.
 

now you can use either transistor ( BJT or FET ) whose base of gate voltage can be controlled by ATmega32 controller pin.....or even as realy as thannara123 guided.... as switch

Good Luck
 

**broken link removed**
change Led to relay
 

sorry i can't get you sir because i m a fresher for embedded industry so i request give me the source code for that..
thanks

---------- Post added at 11:05 ---------- Previous post was at 10:44 ----------

sir pls give me the c code for given below using ATmega32,


Software Overview:

The firmware is written for the Silicon Labs C8051F310 uP.

(“START” ) Set MUTE line on
Set Clock I2C parameters
Display default text on LCD display through RS232
Switch on STOP LED and AUTO LED (default)
Lock all keys except START and AUTO/MANUAL
Poll START and AUTO/M at 100ms intervals using 100ms timer interrupt


If START detected :
Lock all keys except STOP/PAUSE
Poll STOP/PAUSE every 100ms
Disable STOP LED and enable START LED
Enable one second timer
Send RS232 code to display the “Auto” sequence msgs. First is “Oedema” and also display the fixed and elapsed time
Disable MUTE
1) Set LED Red. Send Clock Gen I2C freq increment @ 200Hz for 6 secs (1200 pulses).
2) Set LED Green. Send Clock Gen I2C freq decrement @ 200Hz for 6 secs (1200 pulses)
Repeat 1), 2) above for 300secs total (25 times)
(switch to next sequence)
Send RS232 code to Display – show “Analgesic” and continue showing elapsed time
Send Clock Gen I2C freq increment @ 200Hz for 6 secs (1200 pulses) and stop
Loop for 420 secs (7 mins)
(switch to next sequence)
Send RS232 code to Display – show “Exudation” and continue showing elapsed time
Send Clock Gen I2C freq decrement @ 200Hz for 6 secs (1199 pulses)
3) Send Clock Gen I2C freq increment @ 20Hz for 6 secs (120 pulses)
4) Send Clock Gen I2C freq decrement @ 20Hz for 6 secs (120 pulses)
Repeat 3), 4) above for 180secs total (15 times)
Display “END” on LCD display for 5 secs then -
Return to (“START”)

If AUTO/M detected :
Disable AUTO LED (Green) and enable MANUAL LED (Red)
Poll STOP/OEDEMA/ANALGESIC/EXUDATION/SEDATIVE switches
If STOP switch detected – return to (“START”)
If OEDEMA detected – poll STOP/TIME UP/TIME DOWN switches
Enable OEDEMA LED (Green)
Display ‘OEDEMA’ and “Select Program Time” on RS232 LCD screen
If STOP detected – return to (“START”)
If TIME UP/TIME DOWN detected – increment or decrement time count register
Display Increment/Decrement value on LCD screen
If non-zero value in Time Count register – then add START switch to poll
If START detected :
Lock all keys except STOP and PAUSE
Poll STOP and PAUSE every 100ms
Disable STOP LED and enable START LED
Enable one second timer
Send RS232 code to display “OEDEMA” and set and elapsed time
Disable MUTE
1) Set LED Red. Send Clock Gen I2C freq increment @ 200Hz for 6 secs (1200 pulses).
2) Set LED Green. Send Clock Gen I2C freq decrement @ 200Hz for 6 secs (1200 pulses)
Repeat 1), 2) above 5 times for every count in Time Count register (1 min per count)
Display “END” on LCD display for 5 secs then -
Return to (“START”)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top