Archive for March, 2010

Simple Serial User Interface on PIC

March 30th, 2010 No comments

So today I needed to control some stuff on my PIC by using the terminal on my PC through RS-232 serial. I want to control the speed on 2 motors connected to the PIC, either separately or both of them together. To do that I divided the tasks that the User Interface (UI) had to provide. So from the main menu the user should be able to choose to control

  • Motor A
  • Motor B
  • Both Motors

In each of the sub-menus shown above the user should have some choices for acting on the motors. Before complicating this stuff more, I will show you the method I used to create this simple menu on my 18F2525 PIC. It doesn’t matter if you don’t have this PIC or even any other microcontroller. The concept is the same.

If you try to tackle the problem an if-then-else structure may seem like an easy solution but I can tell you it is going to messy pretty soon! We need a more clear, robust solution. But first let’s see what we need to do.

PIC User Interface Layout

The image pretty much explains it all. If we are at Main Menu the only valid keys are 1, 2 or 3. Each leads to a new sub menu. From there, there are again three choices 0 that takes us back to Main Menu and + or that will need to take an action (colored green). So if we implement this menu you will be able to implement more complex ones based on the same concept.

I got this idea based on Finite State Machine concept but its not quite right so we cannot call it like that! Anyway. Each of the menu item (Main Menu, Motor A, Motor B, Both Motors), is a different state in the program let assign them 0,1,2,3 accordingly. So if we are at state 0 we can go to state 1,2 or 3 with the right key pressed in the terminal. However if we are at state 1, we can only go back to state 0 or stay at the same state and complete some actions (forwards, backwards) with the right buttons pressed, once more.

So the way to implement this is by using switch/case. I think it will be much clearer if I show you the code. First let’s see how to we switch between the states. Read more…

Lego Mindstorms – Interesting Advanced Projects

March 27th, 2010 No comments

When I was a kid I remember building small houses and castles using my Lego pieces collection. Even back then you could tell that people creating that stuff had a really creative thinking and ideas. Looking at todays Lego robotic products you can safely assume that they still have that flare of creativity 🙂

Few years back I also bought my first Mindstorms kit. I was quite amazed by the possibilities of this kit. However, me as a person, I have short imagination 🙂 therefore I quickly run out of ideas and moved on to other stuff.

Recently I came across some interesting projects done using the newest NXT mindstorms by Lego and I was truly amazed BIG TIME! Some people have really clever ideas and they implement them beautifully. Not only they are able to put together a working body frame but also there is some clever programming too! Read more…

Incoming search terms:

  • lego mindstorms projects ideas (32)
  • lego mindstorms advanced projects (26)
  • lego mindstorm project ideas (23)
  • advanced lego projects (19)
  • mindstorm projects (16)
  • lego mindstorm advanced projects (16)
  • Advanced NXT Projects (15)
  • lego mindstorms project ideas (13)
  • advanced lego mindstorm projects (13)
  • lego mindstorm projects ideas (12)
Categories: electronics, general Tags: