3 Mistakes of LCD with MSP430 [SOLVED]

You might have scratched your head and said, “OMG!! Its difficult to interface MSP430 and LCD!” If you have been working on it then you surely would have! Also here in today’s blog I would like to add another solution too. I keep hearing that msp430 cannot be used as atmega. Whenever asked the reason what people say is that the logic level doesnt match. One is in cmos and other is in ttl. Well, one should agree the point that we hobby project makers are always a long way behind the companies. That is the main reason in which we dont employ mcu as msp430 which is small and but highly powerful. In my previous post I had shared my experience with TI ADC Phase 1. I had used msp430f149 for my project and I had faced similar problems “logic mismatch”. So today what I am writing will be concentrated on how to solve this problem. My team has found a good solution to solve this issue.

 Before coming to solution its always required to know what exactly the problem is. Let me give an example and explain the problem.

 The most important problem everyone has is LCD 16×2 interfacing with MSP430. The LCD 16×2 which is usually available in market works on TTL logic. Now what is TTL logic is?

As wiki says, “Transistor–transistor logic (TTL) is a class of digital circuits built from bipolar junction transistors (BJT) and resistors. It is called transistor–transistor logic because both the logic gating function (e.g., AND) and the amplifying function are performed by transistors (contrast with RTL and DTL). Standard TTL circuits operate with a 5-volt power supply. A TTL input signal is defined as “low” when between 0V and 0.8V with respect to the ground terminal, and “high” when between 2.2V and 5V(precise logic levels vary slightly between sub-types and by temperature). TTL outputs are typically restricted to narrower limits of between 0V and 0.4V for a “low” and between 2.6V and 5V for a “high”, providing 0.4V of noise immunity”

 It should be noted that, though TTL has logic low as <0.8V and high as >2.6V many a times the actual value will be low as <1.5V and high as >3.5V.

 Now coming to CMOS logic, What is it mean? These logic devices works with 3.3Vpower supply. Here usually low means <0.8V and high means >2.3V.

 Observing TTL and CMOS, if ideal cases are considered then there is no trouble in conversion between the two logic levels. 3.3V will be considered as high in TTL. But problem is that ideal case doesnt exit!

So it is much required to do the conversion to get rid of this problem. Hence from many months a lot of work in this part has gone and few possible solution where done. Few among them are mentioned below.

  1. Using pull up resistor : Well some people claim this is one of the best and easy solution for this problem. However when comes to LCD interfacing this just doesnt work!

  2. Transistor conversion : Using a BJT or MOSFET people say it is possible to convert. Theoretically one can prove this. There are people who have done circuits based on this and solved the LCD problem. However its is that fast and it usually become clumsy.

  3. Use another controller : This is one also possible but you need to integrate two controllers. One working in 5V logic and other in 3.3V. Example is MSP430 and ATMEGA. Connect LCD to atmega. This has one main problem that you require another controller! So what is the point of using MSP then? For testing purpose one can use it but when comes to hardware this just complicates the overall thing!

  4. Therefore, it was much required to see whether there is any IC which can solve this problem. However, if you search in google you do get a lot of ICs which solves this problem, but there are only few which actually solves! Others have problem of gate delays and frequency matching. Hence a proper IC has to be selected. The IC which I and my teammates found providing the best solution was CD 4050. TI provides this IC too! Use this IC to match the logic levels.

 Now let me concentrate mainly on LCD solution and explain in more detail. For any other logic mismatch you just have to change the LCD with your required device 🙂 Thats all!

 The main reasons for not working of LCD interface in MSP430 is –

1)LCD (16 x 2) display works with 5V logic level (TTL), where as TI MCU works with 3V logic levels (CMOS). There is voltage level mismatch between the two components.

2) Not understanding data-sheet of LCD 16×2. Contrast pin is not connected properly. LCD which I used datasheet can be seen at http://www.datasheetarchive.com/JHD162A-datasheet.html

3)Initialization problems.

(These were the problems which we faced)

Here are the steps for interfacing TIMCU and LCD (16×2). I have chosen MSP430F149 Micro controller to interface to LCD and have used 8bit logic interface.

Do the connections as you want. However keeping in mind that you do it in sequence. This is will help in easier debugging. In the example provided, I have considered P1 as address/control and P2 as data pins.

Voltage Level mismatch:

To solve the problem of voltage level mismatch between the TIMCU and LCD, as said we will use logic level shifter IC. HCF4050 (or CD4050) from ST electronics. Its a 16 pin IC which converts 3.3V level to 5V level, and 0v to 0v level. These have CMOS hex convertors. The data sheet of IC- HCF4050 can be obtained from the link www.8051projects.info/datasheets/CD_4049.PDF

I will explain one pin connection. RS and similarly others will follow. A diagrammatic representation is as shown. You will require 2- HCF4050 IC to connect the entire LCD to MSP430F149 in 8bit method.

Now in-case if you have used 4bit method, then you require 2 CD4050 since IC supports only 6 conversions. Dont ask me the code for this. Because, if I give the code, then the third problem you will solve very easily! So some problems should be there otherwise you will do copy pasting! Learn and paste ! That is why I am giving. I will write a library file and will try updating it in case you could not solve the problem!

 For any other device replace the LCD with your device. Dont forget to use the CD4050. In the last, for every problem there exists a proper solution. Its only the way in which you find it is different.

 To solve this problem we have burnt 2 LCDs and 2 MCUs! 😀 Well it paid well though 🙂

The blog is re-blogged at http://vinaykumarn.wordpress.com/2012/03/26/three-mistakes-of-the-lcd-interfacing-lcd-to-msp430/

He is one among my teammate who took time drawing images for you to better understand 🙂

This slideshow requires JavaScript.


MSPFET430UIF DRIVERS Problem [Solved]

How to solve TI-FET430UIF prorammer driver problem:

If u are using MSP430 and at some point of time you would have faced this trouble… U will try loaing your program to ur target board through FET UIF but you will get a fatal error stating programmer not working!! check if the programmer is connected to ur computer!!! But you know that the programmer is correctly connected an you would see red or green leds glowing in the programmer.. U might have scratched your head to solve this problem!!! If so then you are also one person like me, who faced it!!!. For 15days I had been scratching my head to rectify this problem.. and today I did it… SO i thought I would write this blog so that it would help someone at some point of time in future 🙂

The problem description in detail:

i m working on msp430f149. i was trying a sample led blink program.
The code is
#include “msp430x149.h”
void main()
int i=0;
for(i=0;i Firmware V3 to V2 downgrader.

Let me tell you how I solved my case!!

1)I installed IAR workbench. New version
2)I downloaded latest version of MSP430.dll file for advance programmers from TI site. (27MB file)
3)Went to device manager->texas instrument (warning symbol)->update driver->select the folder where u have msp430.dll file->install the driver.
4) You would see that the driver is installed in device manager. It would be shown as com port in the port division. as MSP430FETUIF-CDC or VPC.(COM57) (Note down the COM no)
5)Now go to AR WORKBENCH in the start menu click-> Firmware V3 to V2 downgrader.
6)A command promt wil open -> press y-> another command promt will open-> press continue-press y…..-> finish updating frimware.
7)remove ur programmer->reconnect the same. Devive manager u can see that the texas instruments option would be under other devices now.
8)Go to IAR. Write led blick program. Go to options in ur project->select debugger->select TI-Debugger-UIF->Select the device port as COM57(ur COM no). By default it will be automatic.
9)Debug and Download the code->U wil get a warning->Device driver is not matching. Do you want to update the drivers.->say yes. ->Firmware updating complete.->Erasing memory location->Downloading program… RUN!!! Your programmer will start working superbly once again!! 🙂

This is how I solved it!! If u hav stuck up anywere then post your prob here. I will try providing solution if its related to it…. 15days research I had done!!! 😀

This slideshow requires JavaScript.

PCB Designing using Eagle

Fed up with soldering circuits with wires and thinking all over to find where the loose connection did happen! Or why the circuit is not function? If you are at this point then better jump to PCBs. Lot of problems will be solved. If u wants to try out something new, u can also go with PCB designs. So let’s see how to design PCB using Eagle software. I am going to show how to design PCB from schematic and later in board. In the next tutorial I will speak about PCB etching and debugging.
If u have ever designed a circuit In GPCB (general purpose PCB) then u might know the complexity involved in soldering and giving connections. When u do testing, most of the time, the circuit will be shorted! Or if u doesn’t want your board to fail in middle of competition or demonstration it’s good to proceed with PCBs. If u go for professional shop, then they will make sure to empty ur pockets! If the design is simple why not do it our self? The tutorial will show how to build Ur PCB in quiet a small amount (About Rs.250 to Rs.300)
To design the schematic and the pcb layout, we’ll be using EAGLE which is a tool created for just that. It has a large number of parts and if you don’t find one that you need, you can create one yourself very easily. You can download the light version here, it has all the features that the professional version does. The only limitation being that the board size can’t exceed 10cmx8cm. If you want to make bigger boards then you can purchase the professional version (I’m sure you can figure out how to get it without paying but just remember that its illegal if you want to use it professionally).
I just use EAGLE because it’s the first tool I used to create PCB’s and I’ve been using it ever since. There are other PCB editors like DipTrace, EasyPCB etc which provide better UI and autorouting options than eagle. Once you know how to use EAGLE, you can use the other editors with ease.
To get you acquainted with the basics of EAGLE we’ll be designing a simple LED flasher using the 555 IC.
After downloading and installing EAGLE, open it and create a new project and give it a name(It’ll be a folder icon under eagle).

Then create a new schematic by going to File>New> Schematic. EAGLE doesn’t ask you a name like most other apps so its better if you save it with a unique name or else you’ll end up with a bunch of files called “untitled”. You’ll get a screen like this

Click on the Add button on the left toolbar, this dialog will let you access all the parts available in eagle but the search function isn’t that great, you can however, search using a wildcard character if you don’t know the exact part number. For example, search for “*555” and select ne555 from the list .

Place the device anywhere you want using the left mouse button.

Next we’ll add resistors which can be found in the same ADD dialog, but EAGLE has a lot of packages for resistors and capacitors which can be a bit confusing for a beginner. Search for “resistor” in the search box
and you’ll get a bunch of results, choose resistor>R-US_ and select the 10mm package.

Now place four resistors as shown.

Now we’ll place capacitors. Click on ADD again and search for “capacitor” and select rcl>CPOL-US and select the 5mm package and place it on the layout. Add another capacitor but this time an 8mm package. It doesn’t matter in which library you find the package as long its of the correct size.

After you’ve placed them, it should look something like this

(C1 is the 5mm package and C2 is the 8mm package)
Now we’ll place two LED’s by searching for “LED” and selecting led>LED and then the 5mm package. If you want to rotate any part to fit the schematic, you can do so by selecting the component and clicking the right mouse button.

Now we’ll place a potentiometer, again click on ADD, search for “potentiometer” and select pot>TRIM_US and S64W package. Im choosing this package because this is the actual pot that ill be using on the PCB, if you have a different type of pot then choose the right one.

If you want to move any component around, select the “move” button from the left toolbar and select on the component you want to move and move it around. If it’s a big component then just pressing inside the empty space inside it wont move it, you have to select it using the + mark inside the component. I found this out after a lot of cursing.
Now we’ll place a two pin header for connecting the power supply.

Now we’ll name all the components so they’re easier to recognize.
Select the Info button and click on R4 and type in “1.5K” in the value box.

Do the same for R1(470Ω),R2(470Ω) , R3 (1.5K) and R5(220K).
Now assign the values for the capacitors. C1 is 10uF and c2 is 100uF.

Now we’ll begin connecting all the components. To easily connect wires you can choose to see the pins by going to view>Display/Hide Layers and selecting Pins. Now Select the wire tool and click on one of the pins and move your mouse to the other pin which you want to connect and click on it. If you want to stop the connection on a pin then you have to double click on that pin or you can press escape after you’ve connected it. Make the connections as shown.

If you’re not sure whether the connection has taken place to a certain component then select the move button and move the component around, if the wire also moves around with it, it means its connected. If not, select the delete tool and remove the wire and re-connect.
After everything is done, click on the info button and then click on any wire which is connected to VCC and change its name to “VCC”, it would be something like N$10. Do the same for the ground wire and name it “GND”. This is needed later when designing the PCB layout.
That’s it for the schematic. If you want you can add a frame containing the details in case you have to submit it somewhere by going to ADD and searching for “frame” and selecting whichever size you want.
Now we’ll move onto actually designing the PCB. Click on the Board button present on the top toolbar and select yes when it asks if you want to create a new board. You’ll get a new window which has a black background containg all the parts jumbled together on one side. There’s a white border towards the right, this is the actual workable area of the PCB. You can resize the size of the PCB using these white lines.

Now its obvious that you want your PCB to be as small as possible but you wont know how small you can make it until you try placing the components. In any circuit, start with the main component in the center and put the others around it. You can then see how they actually connect to each other and move them around if necessary.
Start by reducing the workable area to a size slightly bigger than you want. To do this, select the move tool, click on the right most line and bring it towards the left. Do the same for the top line and bring it down to reduce the size, you should get something like this-

Now select the 555 IC and move it towards the center.

Ok so I just realized I’ve made a mistake in the schematic, instead of connecting one of the wires to the middle of the pot, I’ve connected it to the other end. But its not a big deal, you can just go back to the schematic and correct it. If you do so, you’ll see that it automatically gets updated in the board layout too.
The wrong connection is shown as a red cross mark.

Use the delete button to delete the wrong connection and re-connect it using the wire tool.
The corrected version –

Now move all the other parts around until they look something like this. Again, to rotate a part use the right click.

I’ve moved all the parts towards the left- bottom corner. To do this, click on the selection box tool and create an area around all the parts, then select the move button and right click on any part and click move group and move it to the corner.
To re-route the air wires to their closest points you can go to Tools and select ratsnest.
We can now reduce the PCB area even more since we have a lot of empty space.

Before we begin routing wires we have to set the properties of the routing like minimum width of the wire, spacing between the wires etc. These are called “Design rules” and the default rules in EAGLE are not exactly hobbyist friendly so it has to be tweaked a little. I’ve uploaded a file containing the Design rules that I use so you can use it directly, or you can set the values yourself.
Download the Desing Rules File here
If you want to use the file I’ve uploaded, go to Edit> Design rules, click on Load and select the file and click OK.
If you want to change it manually, these are the settings

This sets the minimum distance between two routings.

This is for the minimum width of the wire.

I haven’t changed anything in this but this is to set the size of the pads and vias.
After setting the rules we can now start routing. EAGLE has a decent autorouter which you can use for small circuits.
Go to Tools and select autorouter, this dialog will let you access the routing settings like number of layers, cost of each layer etc. Select NA for top layer and ‘–‘ for bottom layer since we’re doing only a single sided board.

After you click OK, you’ll see a bunch of blue lines, these are the actual copper traces. If you use this layout to etch it’ll work but it’s always a good idea to add a power plane to the circuit. A power plane is a large area on the layout which is connected to either VCC or ground. There are many reasons to add a power plane, it’ll reduce the amount of etchant required, it’ll help the toner stick better and it’ll help carry large currents in case your circuit needs it. You can do this by selecting the polygon tool from the left toolbar and drawing a box around the layout like this-

Click on the info button and then on the polygon and type in the isolate value as 1.2 and name as “VCC”. The isolate value defines the minimum clearance between the plane and any other signal. The name you give connects the plane to that signal. If you cant rename it, go to edit> name, click on the polygon and rename it.

Now go to tools and press ratsnest, you should get something like this-

If it gives an error saying wrong polygon or something like that then you have to do the following.
Zoom in on the point where you ended the polygon, mine was upper left corner

You can see there are multiple dots there, you have to delete one of them so that it looks like this.

Now try ratsnest again and it should work.
Now create one more polygon as before but this time only update the isolate value and leave the name as whatever it is. You cannot add two power planes in a single layer, so this polygon will just fill empty spaces with copper without connecting it to anything. This will reduce the amount of etchant required to etch the pcb.

Well that’s the final PCB layout which you can use to etch. I haven’t covered all the concepts but I hope its enough to get you started. There are a few things I’d like to mention,
1. There’s no option to undo the wires created by the autorouter. To delete them, select all the wires using the selection box, select rip-up and right click on any wire and press rip-up all.
2. Most of the time the routing wont be 100%, so you’ll have to use some external wires, to do this you have to add vias where you want to connect external wires and route them manually.
3. To hide/unhide any layers use the Display/hide layers dialog found in the View menu.
A tutorial on etching the PCB is coming soon.
Re – Posted from http://www.amtek.wordpress.com

This slideshow requires JavaScript.