Serial port

Thread Starter

justrazvan

Joined Apr 11, 2006
3
hello. could someone please help me. i have to desing a system that i should connect to a serial port of a machine, collect data from there, display it on a LCD and eventually store it in a flash or something.
i have a scheme in orcad, but i dont think i can use it. i dont know what ICs i need. i dont know what uC i should choose. i think i need a max232, too.
if anyone has something like this already done, or can help me with some advice... please dont hesitate.
thank you in advance.
 

Papabravo

Joined Feb 24, 2006
21,094
Originally posted by justrazvan@Apr 11 2006, 03:46 PM
hello. could someone please help me. i have to desing a system that i should connect to a serial port of a machine, collect data from there, display it on a LCD and eventually store it in a flash or something.
i have a scheme in orcad, but i dont think i can use it. i dont know what ICs i need. i dont know what uC i should choose. i think i need a max232, too.
if anyone has something like this already done, or can help me with some advice... please dont hesitate.
thank you in advance.
[post=16095]Quoted post[/post]​
Let's start with your requirements. This is not an exhaustive list, but should serve as a starting point.

1. What "machine" are you connecting to?
2. What data rate is the serial port running at?
3. Is it asyncronous or syncronous?
4. Are you sure that th electical interface is RS-232?
5. How much data are we talking about?
6. What size LCD display did you have in mind?
7. How much data sotrage do you need?

It might be a good idea to capture your requirements in a separate document so that you can revise and update it.

Why don't you post what you have from OrCAD so we can see what you are talking about?
 

Thread Starter

justrazvan

Joined Apr 11, 2006
3
Originally posted by Papabravo@Apr 11 2006, 04:54 PM
Let's start with your requirements. This is not an exhaustive list, but should serve as a starting point.

1. What "machine" are you connecting to?
2. What data rate is the serial port running at?
3. Is it asyncronous or syncronous?
4. Are you sure that th electical interface is RS-232?
5. How much data are we talking about?
6. What size LCD display did you have in mind?
7. How much data sotrage do you need?

It might be a good idea to capture your requirements in a separate document so that you can revise and update it.

Why don't you post what you have from OrCAD so we can see what you are talking about?
[post=16099]Quoted post[/post]​

Thank you for your reply.
My machine is a vending machine, which has a serial port. I dont know much about it, i dont know how can i verify it...
I'm not sure about the RS232, that was my ideea and i dont really trust it.
The data is not very significant i guess; there are some information about the machine(sales...).. some text i want to display on the lcd and, eventually store it in a memory for later download in a pc. In conclusion the data storage is low i suppose.
The LCD i have in mind is a 1x16 or 2x16 one.
I have uploaded my scheme.
Thank you again for you amability.
 

Papabravo

Joined Feb 24, 2006
21,094
Unless you have some way to determine what electrical interface you are going to connect to, anything we do at this point will be a complete and absolute waste of time. I see the DB-9 connector and that might be a good sign -- or not. With a battery operated voltmeter, please measure the DC voltage of each pin on the machine you want to connect to and present the results as a table by pin number. Naturally pin 5 with respect to itself will be 0 VDC.

At this point we don't know if the MAX232 with two transmitters and two receivers is what we want. We won't know this until we can find out how many pins are active.

You have selected an ATMEL AT89C51 processor. Do you plan to program the part before or after it is placed on the board?

You have four grounded pushbuttons with pullup resistors. The 8051 has internal weak pullups that you can use on all of it's port pins. You don't need the pullup resistors shown on the diagram.

Pin 31 EA/Vpp needs to be tied high or low. You can't leave it floating. Please read the datasheet to decide which way you want this pin to go.

You have to have an ACTIVE HIGH reset circuit.

Your LCD module is a parallel access type with a Motorola type processor interface. I don't think you want to connect the 8 data lines on the LCD module to the 8051's high order address lines. You may be able to write data to the LCD this way but for sure you will never be able to read anything back.

Since we have an INTEL type processor and a Motorola tye peripheral we need to ask ourselves how we can generate Motorola type control signals from INTEL type control signals. The LCD Module requires three signals:

RS - Register Select is a single address bit. This has to be stable long before the rising edge of E-clock.

R/W_Bar - Read/Write_Bar is a '1' for a READ Cycle and '0' for a Write Cycle. This could also be generated from an address line.

E-clock This signal is used to clock the data into the LCD module. The data is clocked on the FALLING edge.

Your homework is to write down a set of Boolean Equations for generating these three signals(RS, R/W_Bar, E-clock). Once you have the Boolean Equations for these three signals draw up the gates that you will require to implement the functions and add them to your drawing. HINT: all the signals you will need are on Port 2 and Port 3. At a clock frequency of 24 MHz. the processor may be running to fast to successfully write data into the LCD module. You will need to consult the datasheet for the LCD module to see if your design will meet the timing requirements of the LCD module.

I don't know yet if you're going to need an address latch on the low order address lines, let's ignore that for the time being.

How much Flash memory is in the code space on your selected processor? How much non-volitile EEPROM is on your selected processor? How much RAM is in your selected processor?

Are there any other peripherals that you know of at the moment?
 

windoze killa

Joined Feb 23, 2006
605
Originally posted by justrazvan@Apr 12 2006, 08:24 AM
Thank you for your reply.
My machine is a vending machine, which has a serial port. I dont know much about it, i dont know how can i verify it...
I'm not sure about the RS232, that was my ideea and i dont really trust it.
The data is not very significant i guess; there are some information about the machine(sales...).. some text i want to display on the lcd and, eventually store it in a memory for later download in a pc. In conclusion the data storage is low i suppose.
The LCD i have in mind is a 1x16 or 2x16 one.
I have uploaded my scheme.
Thank you again for you amability.
[post=16102]Quoted post[/post]​
Looking at your schematic I agree with Papabravo. Plus there are a few other things.

Your BUT1 to BUT4 aren't connected to anything. They should go to the AVR somewhere.

On the MAX232 you are using T2 and R1. There is nothing wrong with this other than it is breaking convention. Use T1 and R1 or T2 and R2.

It also shows 100nF caps around the MAX232. We use these chips by the dozens and we Use 1uF caps which I believe is what is in the datasheet as well.
 

Papabravo

Joined Feb 24, 2006
21,094
Originally posted by windoze killa@Apr 11 2006, 06:42 PM
... They should go to the AVR somewhere.
...
[post=16108]Quoted post[/post]​
A picky point. Not all Atmel chips are AVR's, they second source a large number of 8051 type parts. In fairness you have to look really close at the pin names and the name which is pretty distorted on the jpeg image.

BTW, good catch on the MAX232 capacitors. If it turns out that the RS-232 interface neds only three wires I was going to recommend a MAX3221 which operates over a wider supply range and has one receiver and one transmitter.
 

windoze killa

Joined Feb 23, 2006
605
Originally posted by Papabravo@Apr 12 2006, 11:06 AM
A picky point. Not all Atmel chips are AVR's, they second source a large number of 8051 type parts. In fairness you have to look really close at the pin names and the name which is pretty distorted on the jpeg image.
Good point. My slip

BTW, good catch on the MAX232 capacitors. If it turns out that the RS-232 interface neds only three wires I was going to recommend a MAX3221 which operates over a wider supply range and has one receiver and one transmitter.
[post=16111]Quoted post[/post]​
Not sure but I think the MAX232 is much cheaper. Also handy having that second port available.
 

Thread Starter

justrazvan

Joined Apr 11, 2006
3
Originally posted by Papabravo@Apr 11 2006, 06:27 PM
Unless you have some way to determine what electrical interface you are going to connect to, anything we do at this point will be a complete and absolute waste of time. I see the DB-9 connector and that might be a good sign -- or not. With a battery operated voltmeter, please measure the DC voltage of each pin on the machine you want to connect to and present the results as a table by pin number. Naturally pin 5 with respect to itself will be 0 VDC.
It is true that I didn't measure the DC voltage of each pin on the machine, but I know this much:
The machine has a DB9 conector
"some data" can be printed with a Rs 232 serial printer with a Baud Rate of 9600, 8 data bit, no parity, 1 stop bit (CITIZEN I-DP 3110-24RF 230 A p/n 9210219 printer recommended) this I know for sure!!!!! BUT this is pretty much all I know about the machine!!!
You have selected an ATMEL AT89C51 processor. Do you plan to program the part before or after it is placed on the board?
I have selected that processor just for start up, and to have something to put in the orcad scheme. I didn't know what processor I should choose. And yes I do have to program it after I'll write the code. After asking other people I came to the conclusion that I should better choose a ATMega8 Processor which I can program with Code Vision. All I need from this processor, for now at least, is to get the data from the machine through that DB9 connector and put it on the LCD. I also have to buy this part, so I'm looking for something cheap :).
About the program part: if I choose a atmel processor I do have where to program it, I mean the programmer.
You have four grounded pushbuttons with pullup resistors. The 8051 has internal weak pullups that you can use on all of it's port pins. You don't need the pullup resistors shown on the diagram.
Thank you for your detailed attention, but I haven't decided what all the buttons are for, so I didn't spend too much time with them. i think I have other priorities right now. (like the uP)
Your LCD module is a parallel access type with a Motorola type processor interface. I don't think you want to connect the 8 data lines on the LCD module to the 8051's high order address lines. You may be able to write data to the LCD this way but for sure you will never be able to read anything back.
Since we have an INTEL type processor and a Motorola tye peripheral we need to ask ourselves how we can generate Motorola type control signals from INTEL type control signals.
how do u know all this? that the processor is a intel type and the lcd is a motorola type processor interface? Could U please guide me in choosing a proper Lcd Module in order to be simple to interface with and to be of the same type as the processors'?
All I want know from the lcd is that it should be simple and cheap :) and probably a 16x1 size. I don't know how to select the lcd module and how to get it's datasheet!
You may be able to write data to the LCD this way but for sure you will never be able to read anything back.
I know I want to write data to the lcd, but why would I need to read anything back?
Are there some registers that need to be read once in a while?

Thank Verry Much for your help! I really appreciate it!
 

Thread Starter

justrazvan

Joined Apr 11, 2006
3
Originally posted by Papabravo@Apr 11 2006, 06:27 PM
Unless you have some way to determine what electrical interface you are going to connect to, anything we do at this point will be a complete and absolute waste of time. I see the DB-9 connector and that might be a good sign -- or not. With a battery operated voltmeter, please measure the DC voltage of each pin on the machine you want to connect to and present the results as a table by pin number. Naturally pin 5 with respect to itself will be 0 VDC.
It is true that I didn't measure the DC voltage of each pin on the machine, but I know this much:
The machine has a DB9 conector
"some data" can be printed with a Rs 232 serial printer with a Baud Rate of 9600, 8 data bit, no parity, 1 stop bit (CITIZEN I-DP 3110-24RF 230 A p/n 9210219 printer recommended) this I know for sure!!!!! BUT this is pretty much all I know about the machine!!!
You have selected an ATMEL AT89C51 processor. Do you plan to program the part before or after it is placed on the board?
I have selected that processor just for start up, and to have something to put in the orcad scheme. I didn't know what processor I should choose. And yes I do have to program it after I'll write the code. After asking other people I came to the conclusion that I should better choose a ATMega8 Processor which I can program with Code Vision. All I need from this processor, for now at least, is to get the data from the machine through that DB9 connector and put it on the LCD. I also have to buy this part, so I'm looking for something cheap :).
About the program part: if I choose a atmel processor I do have where to program it, I mean the programmer.
You have four grounded pushbuttons with pullup resistors. The 8051 has internal weak pullups that you can use on all of it's port pins. You don't need the pullup resistors shown on the diagram.
Thank you for your detailed attention, but I haven't decided what all the buttons are for, so I didn't spend too much time with them. i think I have other priorities right now. (like the uP)
Your LCD module is a parallel access type with a Motorola type processor interface. I don't think you want to connect the 8 data lines on the LCD module to the 8051's high order address lines. You may be able to write data to the LCD this way but for sure you will never be able to read anything back.
Since we have an INTEL type processor and a Motorola tye peripheral we need to ask ourselves how we can generate Motorola type control signals from INTEL type control signals.
how do u know all this? that the processor is a intel type and the lcd is a motorola type processor interface? Could U please guide me in choosing a proper Lcd Module in order to be simple to interface with and to be of the same type as the processors'?
All I want know from the lcd is that it should be simple and cheap :) and probably a 16x1 size. I don't know how to select the lcd module and how to get it's datasheet!
You may be able to write data to the LCD this way but for sure you will never be able to read anything back.
I know I want to write data to the lcd, but why would I need to read anything back?
Are there some registers that need to be read once in a while?

Thank Verry Much for your help! I really appreciate it!
 
Originally posted by Papabravo@Apr 12 2006, 06:36 AM
A picky point. Not all Atmel chips are AVR's, they second source a large number of 8051 type parts. In fairness you have to look really close at the pin names and the name which is pretty distorted on the jpeg image.

BTW, good catch on the MAX232 capacitors. If it turns out that the RS-232 interface neds only three wires I was going to recommend a MAX3221 which operates over a wider supply range and has one receiver and one transmitter.
[post=16111]Quoted post[/post]​
In your circuit the switches are connected to the +5v through a resisitor.

It is really not required.

U can connect your switch, one end directly to controller port pin and other end to Gnd.

Lot of example programs r there in net which will help u to finish your task very easily.There is nothing much there to get confused.

below link should be useful for u.

http://www.blitzlogic.com/proj_avr.htm

Ramesh Anand.R
 
Top