Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   0 or 1? (http://www.chiefdelphi.com/forums/showthread.php?t=43971)

CronosPrime1 13-02-2006 23:17

0 or 1?
 
Is a signal of +5V as opposed to 0V considered a digital 1 or a digital 0? Or does it depend on where? If so, can someone detail when +5V is 1 and when it's 0? I've been confused about this for a while...

phrontist 13-02-2006 23:24

Re: 0 or 1?
 
Quote:

Originally Posted by CronosPrime1
Is a signal of +5V as opposed to 0V considered a digital 1 or a digital 0? Or does it depend on where? If so, can someone detail when +5V is 1 and when it's 0? I've been confused about this for a while...

The digital inputs are pulled to +5v by defualt, so they are 1 when nothing is connected to them. Grounding them sets them to 0.

darist 13-02-2006 23:54

Re: 0 or 1?
 
Commonly:

+5V is a digital 1
0V is a digital 0

This is the case in the FIRST robot controller.

There are other protocols and standards that use different voltage levels to represent 1's and 0's, but I'm not aware of anything in the FIRST RC that is not 5V/0V.

As was mentioned before: remember that if you connect nothing to an input, they will default to +5V (not 0V) when the controller is on.

Good luck!
David A.

KenWittlief 14-02-2006 00:54

Re: 0 or 1?
 
with digital logic the higher voltage signal is always called 1 or H, and the low voltag signal is always 0 or L.

The thing that is sometimes confusing is some signals are active low. For example, reset signals are usually active low. That simply means when you pull the signal low, the device is reset.

Active low signal names usually have a line over the name (not easy to do in a text editor) or the letter L or N tagged on the end, like: RESET_L.

There are electrical reasons why you would sometimes want a signal to be active low intsead of the normally active high, but it would take about a page of this thread to really explain it.

Alan Anderson 14-02-2006 07:39

Re: 0 or 1?
 
Quote:

Originally Posted by KenWittlief
with digital logic the higher voltage signal is always called 1 or H, and the low voltag signal is always 0 or L.

Never say "always".

What you're describing is called positive logic and is how most digital circuits work, including most of the Robot Controller. However, negative logic exists as well. RS-232 serial communication uses negative logic, with a positive voltage being logic 0 and a negative voltage being a logic 1.

paulcd2000 14-02-2006 16:22

Re: 0 or 1?
 
the best thing is (i know this isn't quite an answer) to test the device with a printf and find out when it returns 1 and when it returns 0

aaeamdar 14-02-2006 16:39

Re: 0 or 1?
 
Quote:

Originally Posted by Alan Anderson
Never say "always".

What you're describing is called positive logic and is how most digital circuits work, including most of the Robot Controller. However, negative logic exists as well. RS-232 serial communication uses negative logic, with a positive voltage being logic 0 and a negative voltage being a logic 1.

It's CMOS (Complimentary MOS) versus MOS (metal oxide semi-conductor for those interested). They are two different methods of constructing gates. But I wont bore you young folk with that.

What you're probably really interested in is this: when that switch is not pressed, what is the RC hearing? When it IS pressed, what is the RC hearing? I use the word
Code:

"hearing"
figuratively.

This is most easily tested through the use of the wonderful and beautiful Ms. Printf (I'm in a valentiny mood here). Also, use #defines to good advantage so that you don't have to change a bunch of stuff!

Self-discovery for the win!

Best of luck,
Paul Dennis


All times are GMT -5. The time now is 01:33.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi