Thursday, November 26, 2009

Troubleshooting

One of the biggest challenges in ECE 344 is troubleshooting on the system.

I mean walking through typing stp, then rrd when you want to read the registers.

In comes typical troubleshooting without a debugger, normally you stick some print statements in there and wait for the print fest to begin.

This bothered me because we can't really do this in our architecture very easy. The nice thing is that we learned about sub routines, and you can treat sub routines as functions if you do it right, so what did I do?

I wrote a sub routine that will print the register values at the time you branch and link, the main limitation, is that interrupts can change your register values once you've entered into the subroutine. This is where the mailbox architecture comes in, if you design your system so that the interrupts do as little as possible and leave everything as untouched as possible, you can then go into your print subroutine and it will print the register's last value.

There are probably plenty of other uses you can find for this routine, and maybe even better ways to use it, for example when you enter this subroutine it waits for a key press before you can exit. Once that happens you can return from your branch and link, this is great because now you don't just blow through your whole program before even really seeing anything.

This is untested code as I am unable to make it to the school until Monday at the earliest, but if you want to give it a try I'll link to it at the bottom.

Changes you'll want to make to allow this to integrate with your program is finding your location in memory you can stick the long ascii string I've built.

Additionally you'll need a 32 bit to ascii converting branch and link, which i haven't written, but we have written for our latest program. This will convert the actual register values to a printable value, as well as you'll need a push and pop routine at the beginning and end, with the pointer jumping by 40 each time, if you don't have this you'll have to find a way to get the data from the register's instead of memory as I'm doing.

As I have time I'll upload more files and a more complete solution but this is very far along and should only require small amounts of modification.

NOTE: As with any file you download from google documents, unfortunately just directly downloading it will have format issues. Copy and paste the contents to a new file and save as a .s file, otherwise you'll be chasing your tail trying to find problems that really don't exist.

Check out the code here: Print Function

Friday, November 20, 2009

Thoughts on OS's

So here are my thoughts on os's these days.

I just recently got my new HP netbook. It's a great little device, but here's my worry, it's not very powerful and it's running windows, My old laptop is running windows as well and is slowing to a crawl.

What are some common causes of slowed down computers?
From Computer Hope:
Hard disk drive is short on available disk space.
Several software programs have been installed/uninstalled leaving behind bad files and/or confusing the software.
Data Corruption.
Outdated drivers
Computer is overheating.
Corrupt OS.
Bad Hardware.


It would appear there are two common causes here.
1. The hardware capability is declining.
2. Operating System related errors.

Hold up before you start getting all upset and claiming that if the people who wrote the programs cleaned them up right then you wouldn't have these problems.

What I want to know is why these programs are becoming so integrated with the OS that the OS can't simply clean itself up?

I was watching the Google OS talk as well as reading a little on it. One of the things I noticed and it's becoming a bit of a theme across OS developer's now a day's.

Let's build OS's that are designed for specific hardware and really only market for that.

What I'd really rather see is OS's that when you load them up will look at all hardware connected and self configures itself to be the most optimal OS for that hardware. What this means is now instead of having 300 print drivers loaded into your system and 45 wireless network card configurations, the OS looks at what you have and decides what's best and get's rid of the rest. Typically true hardware to the system should have only those drivers loaded, no more, no less.

I know this sounds crazy and in some ways it is, but what happens next is the OS is also linked up with the web, so let's say you plug in a new hardware item a new sound card, a new stick of ram or something. Things might be a little hokey but with a basic set of drivers that will control (in a limited way) most hardware, you now tell the computer to rescan for system updates, at which point you can optionally load the new driver's for this new device onto your system, and again it re-configures itself to run as optimally as it can with this system.

What can this mean for boot up times? Well if the OS doesn't have to constantly be verifying what equipment you have and assume you just plain have it and go forward from there. If/When it runs into a hiccup such as it expected a stick of ram somewhere and didn't see it, it jumps to the degraded mode until you either update and "auto" re-configure the system or repair the problem.

I think if you can resolve hardware checks as well as re-design the bootup to start simultaneously kick off processes that will help considerably.

Once more, you won't have to constantly be pinging the devices (wasting power) just verifying that the components are there.

Tuesday, November 17, 2009

Syntax

Syntax doesn't require a whole lot of explaining. Mainly get a good source of information that you can understand, in this case we really only get a .pdf file with the reference manual so you really need to make the best of it.

In our "compiler" the system converts the assembly code that you wrote to a 32bit instruction.
This instruction can be analyzed by the student by breaking it down into opcode, from there that will tell you what kind of data can reside in the rest of the instruction.

One thing I'd like to do is write a syntax checker for the PPC 403 that we're using. This would be particularly helpful in writing code off site, and then making sure the syntax is right.

Once you can sucessfully "compile" then you're on to the testing, and possibly will return to this section.

Let me know what you think!!

Google Voice Screwups

This is a pretty hilarious site, they allow anyone to post google voice to text translations which many times turn out to be quite hilarious.

http://gvscrewups.blogspot.com/

Now here's my question some people post the "before" and after versions, is it possible to improve the translator's capabilities knowing this information?

Check it out and let me know what you think.

Wednesday, November 11, 2009

Google Voice

I just ran into another situation where Google can integrate their google voice application into, Google Maps!

I was searching for my doctor's office, it brought up an address and phone number, why not have a clickable link for those logged in that have GV, and they can click call this number and select which phone to ring, OR even text message address/directions to myself....

Just another little idea for the wide world of google voice

Concepts, the Leonardo of Programming

If you don't understand "what" you're trying to do, it's going to be very difficult to write code and/or tests for it.

Learning concepts can be difficult, some of the main things you need to think about "conceptually" is breaking any task down into 3 parts,
  1. Initialization
  2. Code that does the actual work (algorithm)
  3. Exiting
For initialization you can look most of the things up in the user's manual, once you know how to setup the actions you will be using, you can then begin to look at what you're actually wanting to do, which brings us to algorithms.

Algorithms are "how" you're going to accomplish the task you're attempting to complete. My favorite method is drawing it out in a flowchart design. But I have to "see" what I'm doing and that's one way of doing it, once you've managed to really nail this idea down, you can frequently just do it in your head, and reserve doing flow chart's for the more difficult designs that you really can't wrap your head around.

If you don't know your algorithm it's much like trying to write a paragraph about a subject that hasn't been given to you, you'll keep writing and rewriting your paragraph until you finally get the subject, but that doesn't seem very efficient now does it? Figure out your subject (or what you're trying to do) and THEN write the paragraph, much like figuring out your algorithm FIRST then code up the solution, this prevents large quantities of re-writing code.

Finally when you've finished your task, are there any "clean up tasks" that you need to complete? Do you need to return the register's to their original values? Do you need to clear out memory so that another operation doesn't accidentally use data you've shoved out there? Do you need to pop the stack? These are all things you need to answer when you've finished the task your algorithm is attempting to complete.

Tuesday, November 10, 2009

School Reports

What's wrong with School reports today?

Frequently we are told you need X number of pages, so you push and pull at your words to try to force as many as you can out, many times rather then a clear and concise report you end up sometimes obfuscating ( to be evasive, unclear, or confusing) things.

When will it become clear that writing shorter reports that convey the information required are better then long drawn out reports that are 90% bloat and 10% real information?

Looking at Needless words I started thinking about this, I don't know how many reports this semester alone I've written that are really just bloated with meaningless information, in a simple attempt to pass as a "useful" paper.

When will engineering students write reports as clear and concise as the work we will need to produce?

I have read requirements documents that are so indirect that it's a wonder how people can implement them, and in fact I was once told that if they didn't understand the requirements they were writing that well, they would write it more then once in a couple different ways, so as to give them an "out" when the software comes that they can say "this isn't what I meant" and force you to change it.

That's a tough paragraph to read. Re-Worded: If you don't understand the material you're writing about, make it so the people that are reading it can't understand it.

Start writing what you MEAN. Stop writing bloat into your reports. I'm going to give this a try on my next Microprocessors report, I'll let you know what kind of score I get.

No one likes bloat. Me least of all.

Sunday, November 8, 2009

Designing Learning

In today's day and age, is the current methodology of teaching the best approach?

Here's my hypothesis, Changing HOW we are taught can net greater results on a broader spectrum of students.

It's a well known fact that there are different types of learning
from: LD Pride
These Learning styles are, Auditory, Tactile, and Visual.
How can we improve each of these area's in today's classroom?

I believe that if a student doesn't "care" about what they're learning, it's like trying to force oil to mix with water, it doesn't work.

What we need is something that will be the go-between from the oil (the student) and the water (the material). One way to do this is by not stifling creativity, and in fact fostering it, the best engineers in my opinion are the ones who find the most creative solutions!

Point in case, I'm working on my microprocessors class. Right now we are learning how to handle interrupts, using timer's, buttons, led's and various other things. Individually these projects are dry and don't inspire creativity.

My solution suggests that the student attempts to create a game in one case. For example, Simon Say's, a great game, could be a pretty easy one to build, but in building that you learn a lot of things, here are many of them I can think of:
  1. LED Outputs
  2. Pointers
  3. Timer's
  4. Interrupts
  5. Button Presses
  6. LCD (maybe give the user a score?)
  7. Stack
  8. Algorithms
So I could manage to learn all those things and actually have fun doing it.

I am so far having a blast with the class because I can SEE the potential I'm given while learning this information, but many people see it using blinders, where they can only see what's directly ahead of them, and not see the potential, I believe that letting student's pick projects force them to learn how to design a project, work through the team building details, and the final implementation. I don't think this should be a one time project that is part of graduating, but shoot find a project that the student needs to complete that takes each piece, and as you learn, you can build more and more.

For example, let's say you're given a project as a freshman, some of the techniques to build this project may require math level x (doesn't have to be overly difficult), as you push through each semester you can learn more and then literally apply it to a project as you go along, so when you finish your degree you can say...Look I completed this project and it required knowledge and skills in all these area's.


How do you think learning should be implemented in today's day and age? And do you have any ideas for programming that may induce learning indirectly?

Thursday, November 5, 2009

Design and Programming..a Love affair

Let's take a look at design.

If you design your project well, looking at all possibilities up front without coding a single thing you can catch some problems up front that you may run into. One of those may cause messy or unneeded code! That's again the beauty of the artist they can choose whether they want to keep repainting the exact same thing or really go out there and paint something new!

What all can be designed?
For Microprocessors where you have a limited number of register's to use, defining a personal/project standard allows greater code re-use, as well as less code and easier to understand code.

If you define a register as the UART pointer from the beginning and make sure not to change it, you won't have to constantly be re-writing the code to setup a pointer. How many times does that have to happen? Well if everytime you have to drop into your interrupt service routine and determine whether it was a RX or TX bit that sent you running, that's 2 times for every "interrupt". I know it doesn't sound like alot of time, but when you run into a situation where your time is critical, 2 instructions can make that difference.

The short time that it takes to design your project, can multiply the rewards exponentially.

Deciding how you want to setup each module is part of design, would you rather setup the entire initialization in your main routine for each module, and let that handle everything OR modularize everything and put ALL uart related items in the UART section.

This brings up the good point of .include files, by putting all your setup into a .include file, you can now start using that file in new projects and rather then constantly having to re-write a subroutine you just write it once, and any improvements you make are better for all programs, (provided they are in fact better). Writing this I already see a flaw in the design of the program we made in our latest lab!

Guess what? Looking back on it, I realize we have a file called variables that contains the ".set" items that point to the UART and all other associated names, this means that every file that I try to .include the UART routine into has to have the entire variables file included, Guess what we did that with a "register setup file too!!!".

How can this be improved?

I can put all registers that the UART EXPECTS to use in it's .include file as part of the initialization, and make sure that any time I use that file those particular register's are in that state before the subroutine is used, this can occur by pushing the register settings to the stack before any updates to them, then reverting them back, will allow the subroutine to keep using them as expected.

If there is one thing I'll stress, Try to make your code as uncomplicated and easy to understand for yourself and others, Implementing a design can aide in that.

Let me know how you design!!

How to Microprocessor

Recently we were given a lab in microprocessors that requires us to handle alot of interrupts somewhat simultaneously.

For someone that walks into this lab unprepared it can look like a lot, but for some that's a challenge and for other's that's an active barrier, rather then choosing to be prepared for it, you just walk through and hope for the best.

Reading manuals on the syntax or basic tools to use while programming the microprocessor can be boring, and often time's it's easy to forget about what you just learned.

How do you approach a problem like our latest lab (or any other programming project for that matter)

1. Design --You need to know the "picture" you want to paint with your code.
2. Concepts -- You need to know "how" painting that picture can be accomplished
3. Syntax -- You need to know how to "paint" that picture.
4. Testing -- You need to know how to tell if the picture "looks" like you want it to?

I think those are the 4 most important concepts of programming that really need to be understood.

I'm going to post a series of posts about these particular topics!!

Defining Moment

What's your defining moment?

At what point in your life did you decide, enough talking about doing something and literally start doing it?

What pushed you over that edge?

I feel like many times I talk and talk about doing something but never end up really doing it, which is why in some deep recesses of my heart and mind I started this blog. I got tired of talking about all the stuff I "want to do" and started doing them. Don't get me wrong, I've got along way to go before I feel like I've had that "defining moment".

I've done a few things in my life and when I talk about things I'd like/am doing, I suprise other classmates, they're amazed that I do some of the things I do, but then again I talk to classmates and I'm amazed at the things they're doing, it's because when you get into that "routine" of it's just what you do, you forget how special those qualities are.

Keep pushing yourself to your limits and it'll payoff, everyone's defining moment is different, one man's trash is another's gold. Just because the things you do don't sound interesting to you anymore, or 'special', don't forget that it's someone else's gold.

If you have the opportunity to really connect with people and you can mentor someone else interested in what you're doing, do it by all means, you might be that person that pushes someone just that much closer to a defining moment.

Sometimes I think that my Mountain talks with Phil helped push me over that edge, when I came upon the epiphany of the Guitar Hero Challenge, That's when I realized I can do so much more when I push myself to that limit, and I'm fully capable of it too, I just have to realize that excuses are what sometimes consumes us. Being able to understand the difference between an active and passive barriar and how to hurdle it is the biggest part in learning who you are.

Good luck finding that defining moment, and I encourage you to keep pushing on towards it, you may one day look back and realize that your moment occurred and you didn't even notice it.

Monday, November 2, 2009

Google Calendar

Short "rant/post" today about GCal

Google really needs to add a feature you can say that the weekend after date x is the weekend event x occurs.

For example my wife and I went to volleyball on our first date, it was the 7th, so I would be interested in setting an event reminder that will remind me to look up the schedule on the weekend before (or after) the 7th and see if there are any games we can attend.

I think it would be nice to allow not date specific (or day specific) recurring events, but rather recurring events that can be determined easily based on the calendar date of that year....

Just and idea. Let me know what other features Google Calendar should add to their Gcal

Monday, October 26, 2009

Frugal Programming

I was reading the article on msn here
It goes on to talk about wants vs needs, if you want something now what are the chances you'll want it in a year.
I was suddenly struck with the thought, what about "frugal programming" what i mean is, how do you decide what you NEED programs for and what you WANT programs for.

Lets break it down, sometimes I'm doing something repetitive and think I need a program, but in order to write this program it'll take say 4 hours to write and 2 hours to run, but just doing the actual work would take 4 hours.

Which is more valuable? Being able to complete the repetitive task in an efficient manner makes it more of a benefit. In addition getting more practice will definitely make you a better employee.

The problem is you look at it as a "right now" situation. The fact is you need to finish this task as quickly as possible, and you just get something working for this situation and forget about it.

What often happens is you write a program (such as the one above) for a one time task, but you never label it and stick it somewhere that you KNOW you'll find it in the future. Now that time you spent was more in the direction of wasted. Because if the task comes up again you'll either have to spend an hour searching for the program, or you'll have to spend the time re-writing it.

So what I'm trying to say is being a frugal programmer is being a programmer who can reuse what they do in as many way's as possible as to get as much value out of the "item" as you can.

If you don't have some sort of organization you'll forever be repeating work and doings over and over again until you finally sit down and say I'M GOING TO GET ORGANIZED and literally do it.

So far I've been working on a form of organization, it's tough though, because I might write one thing in C, one in perl and another in visual basic, but I have no means of correlating what they are to it. All my programs are stuffed in a folder called programs, and sorted by language.

I just recently came up with a plan (literally about 12 seconds ago), if I put a list of keywords that this particular program could be used for, or describing it in the header, I can write a script that will find all keywords and programs, so if I do a search I might be able to find things quicker.


Until I literally implement it, let me know how you organize your information/programs/data.

First Hosting

Where was your first webpage ever hosted?

With the news that Yahoo has finally killed off GEOCITIES, I immediately recalled 8th grade and sitting in front of the old macintosh's in the library at school using the blink tag and animated gifs.

I still use angelfire, but that's for the time being.

Let me know what you use(ed), and your best gif!!

Wednesday, October 21, 2009

Arcade Challenge: Max RPM Pt I

So I was going to garage sales last saturday and I picked up this beauty.

Its called Max RPM, by Bally Midway, it appears to have been released in 1986.

What I was told by the previous owner is that he received it as part of payment of a debt from someone. He was told it worked, and it turns out it didn't work.

I decided this would be my "car" Man Project. You know how guys have that car or woodworking project in the garage to work on when they need some time alone, this will be mine.

The Arcade came with the schematics needed to get all the wires hooked up right and working.

First I powered it up just to see if it worked, the screen powered up but no video, so I needed to investigate.

When I opened it up I found a few things.




This board wasn't hooked up whatsoever and it looked important.






When I looked around a bit I found this mess, looks like someone cut off the connector. It's ok I have the schematics, I decided that rather then wait around for a connector (Ok, too impatient because I thought this might be the only problem) I soldered them on to the male pins of the board above.

Well I have power going to the boards and I can even hear feedback on the speakers.

Next I wanted to tackle the lights in the front, I really like the $.25 lights because they just remind me of playing in the arcade when I was growing up, once i got power going from the above work, I measured and it looked like there was 14V across the bulbs, thinking that most cars were similar I found some car light bulbs that looked pretty close and plugged them in and Voila we were in business.

So what it looks like I have left for this project is outlined below:
  1. Coin return has cut wires
  2. Credit button has cut wires
  3. Florescent tube doesn't appear to be operational
  4. CRT doesn't display anything or appear to power up.


I also found some tokens in there as well as the key and lock to the back of the unit, the guy i bought it from lost the key to the front so I had to remove it from the inside, I can get it replaced when I finish up, but no sense in doing it until I'm ready.



Total Costs involved:
Purchased for....$10.00
Fuses.............$02.50
-------------------------
$12.50

I'll keep updating costs and detailing what I find out as I go along, keep following as I finish this project.

If you know anyone who has an Arcade that doesn't work that would like to get rid of it, maybe I'll be able to feature it here!

Thursday, October 15, 2009

Google Contacts

How can google make their contact manager more useful for their users (especially Google Voice users)? I have some ideas. Here they go:
  1. Shareable groups (I.E. business and spam numbers for example)
  2. Lookup of your number to see who has your number in their contact list.
  3. Blockability of your number from any and all contacts in Google.
  4. For Phone Type it should be labeled Landline and Mobile.
  5. If you want to list the Attributes/keywords of a number allow that, (kinda already the "groups thing"
  6. Reverse Phone number lookup across the board, you know google has all that data (most likely) already, why not make it easier. I don't mind a couple ads while I'm trying to find out who just called me.

Let me know what you think. Do you have any better ideas for Google to use for their contacts manager?

Thursday, October 8, 2009

Programming Club

So I read a comment on Jeff Atwoods blog someone made that said
First rule of programming is you DO NOT TALK ABOUT PROGRAMMING.

I got to thinking sometimes working quick on your feet can help you improve your skills
so I looked up the "rules of fight club" which I found here: Rules of Fight Club

So I'm thinking heck why not start a "programming club", you come in and program against one other person. So I'm rewriting the rules for programming club here they are:

1st rule: You do not talk about programming club.
2nd rule: You DO NOT talk about programming club.
3rd rule: If someone says "I can't solve it" or passes out, the match is over.
4th rule: Only two people code at a time.
5th rule: Only one match at a time.
6th rule: No books, No internet.
7th rule: Matches will go on as long as they have to
8th rule: If this is your first night at Programming Club, you HAVE to program.

So the question is Who's in? I'm in the Albuquerque NewMexico area, lets get this started.

Go to my Contact Me Page and lets get started! Contact Me

Coding Frustration

First, the reason I posted this is because I can't actually comment on the post by Jeff Atwood here:
Coding Horror

What I would like to comment on as well is finding your bugs, or not even so much as bugs as problems in your pseudocode. I'll be the first to admit that more often then not I would rather sit down with the idea in my head and just code it up, and to be honest at this point in my programming career I have been able to do that quite easily. The problem comes when you start hitting harder and harder blocks of code that you need to build and generate.

I know there's been a few times I've been banging my head on a wall trying to get a particular piece of code to work. When I finally have "given up" and go to another engineer to explain the problem, MID SENTENCE I stop and say "wow I'm retarded" followed by, there is the problem, and most of the time the other engineer didn't even get a chance to say something.

What does that tell you? Recall that sometimes learning things requires more then once sense? I have found that occasionally hearing the pseudo code that I've written can often times improve my understanding of the problem I'm trying to solve, or even the implementation I'm using to solve it.

In fact, sometimes even attempting to blog about the problem brings about different ways of looking at the problem, take a look at my problem where I wanted to grab filenames from selected files!

Windows Selected File Names pt I Posted: Thursday May 28th
Here my solution was to take any particular selected file and simply append it to the clipboard. The problem with this one is it ran the script the same number of times that there were files, this isn't a very efficient way to solve this.


Windows Selected File Names pt II Posted: June 8th
Here my solution required a "copy" to the clipboard, then right clicking on one file and running the script. I still believe there are too many steps, but it's more efficient (I suppose for smaller files but larger sets) to simply copy the file to the clipboard then using the clipboard contents extract the filenames from the path.


Windows Selected File Names pt III
Someday I would like to have a pt III that shows how to use the "currently selected items" that I KNOW has to exist in windows and simply right click and that will determine the filenames, in my opinion that will be the best way to do it.


I had been mulling part 1 over for a while, and finally when I got a working solution, I wrote it up, and not 11 days later I managed to find another (and better IMHO) solution and get it working.

Give it a try next time youre having problems debugging or finding a good algorithm, use another sense.

Let me know how it works out!

Wednesday, October 7, 2009

Microprocessors 10/1/09 -> 10/7/2009

Here are the in class examples that we've covered in class since the 28th

Revised Blink LED's

Branch And Link

Fibonacci using Stacks

Good luck and let me know if you have any questions!

Tuesday, September 29, 2009

Microprocessors 9-28-09

In class today we reviewed the LED problem from last class, then we moved on to rs232 programming.
The updated and working LED program Dr. Pollard wrote is located here: the only difference is nop's

The link to the in class exercise is here:

Basically what we reviewed was receiving data in the RX FIFO, as well as spitting that data back out in the TX FIFO