Archive for October, 2008

Lab 3 – Adder/Subtracter

October 31, 2008

Was about to post the most recent lab in which this lab is simplified into one input at a time, much like an every day calculator. But fat lot of good that particular explanation does without talking about the original adder construction.

So, as the previous entry talked about, everything will be handled in binary and therefore the math is gonna be a little funny, so let’s start there.

When handling any sort of math with binary, the only two answers possible are 0 and 1. So, same rules apply in binary as in decimal. Therefore, 0+0=0, 1+0=1, 1+1=10 (zero carry-the-one). Simple enough yes?

So, to add one “bit” to another, we need two parts. First ,the actual addition and then the carry. Without getting terribly technical the addition is handled by an XOR and the carry by an AND operator. The circuit looks like this:

But that only works for the first bit. Just with normal addition, the first digit is easy, but all further digits need to take into effect the carry digit from the previous addition. Now, just like with normal addition, you’ll never have to carry any number larger than 10 for instance, so in binary, same idea applies, your carry bit never is larger than 1… rather nice, no? Also, another fact, in this case, is if any 2 of the inputs is one, then there will be a carry. Therefore, behold the “full adder”.

Then, you don’t want to have to build that over and over and over again for each pair of bits added, so we simplify the setup to one custom part as seen below:

This particular part can be reused over and over again for as many bits need to be added and is particularly useful in a myriad of scenarios. Just connect the carry out and carry ins.

More to be covered later.
~Locke

What the hell is he talking about? Boolean for dummies

October 29, 2008

It has come to my attention that I am talking over a lot of heads on this blog. I will be doing my best to bring my readership up to speed by posting previous labs (as time allows) so that you the reader will at least get why the info is important, even if the process doesn’t make a terrible amount of sense.

Allow me, for a few minutes, to explain the very background of the engineering in these circuit labs.

In the mid 1800’s a man by the name of George Boole, who was fascinated by number theory, created what is now known as Boolean Logic. This system strives to translate all algebra and arithmetic into a two value system with simple operators. As is widely trivial knowledge today, all computers work in binary (a system of 0’s and 1’s), and therefore uses Boolean logic to actually function.

Why Boolean and why binary? Well, as Murphy’s Law dictates; the more moving parts, the more likely the system will fail. So why do operations in this crazy math system? With only two possible outcomes and further cooperation at the atomic level (with magnetism and “spin”) then Boolean algebra is the only real choice.

I will explain the processes further in other labs, but I will try to do a brief overview.

Binary:
There are a few theories in Binary that need to be covered before we continue. Mainly, translating numbers into and out of binary. Let us start with base 10 (decimal) which we are all familiar with. First, start with a number, like 425. When you say it aloud, it’s four hundred-twenty-five. This can also be construed as (4×100 + 2×10 + 5×1). Binary is much the same, but smaller. So, if your number is 110100111, then you just work down the line in powers of 2. So 110100111 is 1×1 + 1×2 + 1×4 + 0x8… and so on, returning 423.

Also in computer-speak, shorthand for binary comes in incredibly useful. The two most common are octal (base 8) and hexadecimal (base 16).

To convert from binary to octal, just group numbers by 3’s. So 110100111 becomes 110 100 111 and then translates to 6 4 7.

To convert from binary to hexadecimal, group numbers by 4’s. So 110100111 becomes 0011 1010 0111 which then is translated to 3 A(9+1=A) 7.

These shorthand translations come in incredibly useful when trying to simplify keystrokes for instance, seeing as they are all handled by ASCII code. There are other uses, but it comes down to hex or oct are just ways to shorten code.

Boolean

With Boolean algebra, there are 4 operators. 

NOT: this inverts the input given.  If input is 1, then output will be 0.  This operation can be drawn as a prime mark (‘) or a bar over the input.

AND: This operator handles a situation that is true for both inputs.  Usually this is modeled by “multiplication” or a V.

OR: This operator handles situations where ANY input is
true.  Usually this is modeled by “addition” or an inverted V.  This is, in general terms, like the opposite of AND. 

XOR:  The last combination required.  This handles variables when you only care if ONE of them is 1.  This is usually shown by a
circled plus sign.

This all may sound confusing… and I will agree. These are just the basics and raw facts. More info can be found on wikipedia and other online sources. I will be explaining their uses and implementations further in other lab reports, seeing as information without context is useless.

Until next time,
~Locke

More info

October 27, 2008

So, after talking directly to some of my readers, I think some background info would be helpful. I will be posting both a ECE article and a JAVA article to try and bring readers up to speed. Also, I am working on getting older labs/projects written up so they can be posted. I am sure you guys don’t want to read the direct lab write-ups as they are rather dry. I meant this blog to be a lay-mans sharing of what I am working toward in a greater scheme. It is not my intention to teach exactly everything that is going on but instead write a “how it’s made” set of articles so when people ask me “what on earth does an E.E. do?” I can answer here.

Stay tuned for more stuff!
~Locke

Simple Calculator… Yeah Right

October 24, 2008

First, HUGE thanks to Karel. Without his help, I would not have been able to finish this assignment on time.

So, as I stated in my previous entry, this week’s Java homework was to make a calculator that took user input like “3 + 4” or “3.7 / 6” kind of thing. I was having all sorts of trouble with it.

First try:
Tried to implement the program with a method that checked the sign and then passed the value and a true/false value that checked if the numbers were actually numbers.
FAIL

Second try:
Could not get the program to recognize the signs I was putting in. Solution: figure out the ASCII value and use a SWITCH statement to handle the 5 different operations. Next, implement a TRY-CATCH statement to test if the numbers were numbers and life would be good? No. Asked for help from the professor about my program and he responded “No TRY-CATCH. Can’t use those, they haven’t been covered yet”.
SCRAPPED

Third try:
With some input from Karel, I used hasNextDouble() which returns boolean values. If TRUE, then go through the program, if FALSE, program quits before an error can occur. By then using the equals(char) method, I was able to get the whole program to work. Took a last hit of the crowbar to get it to compile correctly, but it works. Even had enough time to do a INT or DOUBLE checker to return even cleaner values.
SUCCESS!

Link to code

~Locke

Lab 8 – Flip Flops

October 24, 2008

No, this isn’t a political commentary, but a post on my most recent lab for my Digital Circuit Logic class.

Today’s lab was about Flip-Flops, a nifty little toy that “remembers” previous inputs and uses them to determine future inputs.  I still am having trouble with the how and why, but when it comes to labs, this one was refreshingly easy.

Part 1: manually build an S-R latch:

Cake.  As seen below, just feed the output of one NOR gate into the other and use a S (set) and R (reset) as the inputs.  Your outputs are Q and Q’.



Part 2: Manually build a D Flip-Flop

This, in and of itself is not difficult. Start with a S-R latch and connect S and R each to the output of their own AND gate. Then the AND gates are connected to a clock and a “data” (D) and repeated. I had trouble implementing this circuit only because of human error. I was using NAND gates rather than NOR gates with my S-R latch, which in this case always returned TRUE. Check the figure below.



Part 3: Construct a T latch with a J-K latch:

This was cake. Straight from the book. Just connect J and K together and call it T and hook up the clock so that it will “toggle” the output if J=1 and do nothing if J=0. Again, diagrams:



That was this week’s lab. It was really nice to be able to get it done in only an hour or so, rather than 4.

~Locke

Filler

October 15, 2008

So just registered this wordpress blog.  Gonna see what I can do to utilize it properly.
A bit of info:
Name: John Purcell
Age: 22
Job: School: Electrical Engineering
Location: Ft. Collins CO

Interests:
EVE Online (Lockefox)
Guitar Hero
Team Fortress (Locke.Renard)

I will be posting mostly school stuff on this blog.  If you’re interested in general, the posts will be pointing to:

http://www.engr.colostate.edu/~jjpurcel

Site is currently under construction, so sorry for its state depending on when you access it.

~Locke

Hello world!

October 15, 2008

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!