Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 135,912 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,552 people online right now. Registration is fast and FREE... Join Now!




C program

 
Reply to this topicStart new topic

C program

pinkpot
19 May, 2008 - 06:06 AM
Post #1

New D.I.C Head
*

Joined: 19 May, 2008
Posts: 2

May I know how to check the status of a single switch using C program??
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: C Program
19 May, 2008 - 06:27 AM
Post #2

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,514



Thanked: 96 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
Your question doesn't actually make sense, can you expand on it a little?

Do you mean switches like switch statements and cases?
User is offlineProfile CardPM
+Quote Post

pinkpot
RE: C Program
19 May, 2008 - 09:27 PM
Post #3

New D.I.C Head
*

Joined: 19 May, 2008
Posts: 2

QUOTE(pinkpot @ 19 May, 2008 - 07:06 AM) *

May I know how to check the status of a single switch using C program??



hmmm.. i mean if i were to connect a switch to a microchip how could i possible check whether it works by C statement??
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: C Program
19 May, 2008 - 09:30 PM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,433



Thanked: 64 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Can you not be so brief? If you fully describe your situation/project, you'll get a much better answer.

I've read this post over a few times, & I still don't know exactly what you are trying to accomplish.
From what I gather, you have a dip switch, & you want to connect it to the computer & get it's value.

Which Operating System are you using? Which processor... to what detail are you trying to accomplish this? Full details please biggrin.gif
User is offlineProfile CardPM
+Quote Post

Cerolobo
RE: C Program
19 May, 2008 - 09:52 PM
Post #5

D.I.C Regular
Group Icon

Joined: 5 Apr, 2008
Posts: 440



Thanked: 31 times
My Contributions
QUOTE
hmmm.. i mean if i were to connect a switch to a microchip how could i possible check whether it works by C statement??

I do not know what type of microchip you are using, so I can't really go into any code.

Generally, you would have the power going to one end of the switch, the other end of the switch would be attached to one of the ports. Another port would be attached to the trigger of the switch. You would set the port attached to the trigger to send out a signal, which will cause the switch to activate, assuming it is working. From here, you would have to check the port that is attached to the second part that the switch bridged. If there is power on that pin, then it does work.

Since switches are no instant, you will have to add some type of delay, and actually give the pin a grace period. A pin interrupt might work, but again, I don't know what chip you are using.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 07:49AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month