Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

which is the best microcontroller for rs232 comm. and string processing

Status
Not open for further replies.

adnan_merter

Full Member level 3
Joined
Jan 23, 2008
Messages
160
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Location
The most beautiful city of the world
Activity points
2,526
hi,

can you advice me few microcontroller for rs232 communication 300-19200 baud and string operations at the same time

it can receive some strings and proccess it and store the required values

thanks
 

Ehr... any microcontroller with a UART would do that...
 

no it is only enough for rs232 communication,

but it has to receive strings and compare them with already defined strings, if they contain the correct characters, received strings should be stored in some variables

i am already trying to run my codes on 18f2550, it has speed and enough ram for this operation but i couldnt get the expected result
 

Hi,

You need to show your code and circuit diagram, rs232 works fine of the 18Fs, have one feeding this pc 24/7.
 

As already mentioned, the 18F2550 is perfectly capable of this task.

I've taken a look at your code and made a couple of comments - clearly your problem lies in the code or circuit, not in the choice of PIC.

I use CCS PICC myself and have used a good number of 18F2550's.
 

Hi,

Right , now remember your other previous posts now I saw that bits about 300 and 1200 baud etc.

Afraid I cannot help with the C code. though think the way to go is just go back to a simple 1200 baud transmission accepting simple keyboard characters , get that working ok then build up from that.

Can you give some detail of the 1200 baud data your are sending, how many bytes, what form, ascii or hex and what time between each batch of data as I think that was an important factor for you. I might be able to try it on my system.
 

Hi,

Right , now remember your other previous posts now I saw that bits about 300 and 1200 baud etc.

Afraid I cannot help with the C code. though think the way to go is just go back to a simple 1200 baud transmission accepting simple keyboard characters , get that working ok then build up from that.

Can you give some detail of the 1200 baud data your are sending, how many bytes, what form, ascii or hex and what time between each batch of data as I think that was an important factor for you. I might be able to try it on my system.

i already gave a link above, you can check the code.

my comm. baudrate is variable, it can change 300 to 19200.

the data consist of a series of ASCII chars and the first line starts with STX char and each line ends with CR+LF, and the last line ends CR+LF+ETX+! in order to tell the receiver that transmission is over. Each line does not contain more than 22chars.

1. [STX][D0][D1]............[Dn][CR][LF]
2. [D0][D1]....................[Dn][CR][LF]
.
.
.
n. [D0][D1]............[Dn][CR][LF][ETX]!
 

the key in these aplications is to use an ISR and not standard I/O routines,
prepare a good buffer for all lines, unsigned char mybuffer[n][22]; where n is the number of lines you can read at once.
use the ISR to read each byte once it gets to the microcontroller.
initialize your line counter to 0 with the STX (no need to save on buffer)
all the CR LF makes the line counter to increment (also, no need to save in buffer just a plain 0 [not character '0']).
and detect the end of the transmission with ETX, (maybe you need to prepare an extra-swappable buffer while you analyze this set of data once it gets the ETX)

then you can compare each mybuffer with your actual data...
 

the key in these aplications is to use an ISR and not standard I/O routines,
prepare a good buffer for all lines, unsigned char mybuffer[n][22]; where n is the number of lines you can read at once.
use the ISR to read each byte once it gets to the microcontroller.
initialize your line counter to 0 with the STX (no need to save on buffer)
all the CR LF makes the line counter to increment (also, no need to save in buffer just a plain 0 [not character '0']).
and detect the end of the transmission with ETX, (maybe you need to prepare an extra-swappable buffer while you analyze this set of data once it gets the ETX)

then you can compare each mybuffer with your actual data...


The problem is pic doesnt have enough ram memory to store all lines and the number of lines and the lenght of each line can change

so i need an algorithm that can compare each line when the LF char received and just before next char received i think pic has enough speed to do that. The problem is my code
 

The problem is pic doesnt have enough ram memory to store all lines and the number of lines and the lenght of each line can change

so i need an algorithm that can compare each line when the LF char received and just before next char received i think pic has enough speed to do that. The problem is my code

so, post your code. i hope it still uses ISR even if it decodes line per line...
 

Its hard to tell what is best, when criteria not defined. By default best uC which is free.

All depends from many parameters, price, availability in shops, implementation design complexity with other parts, support hardware/software, case package (smd,DIP,...), ...

But if you whant some newer look AVR32 and PIC32 generation.

Keep in mind that basic serial link can do very well trained veteran in uC world 8051 like 89C2051.

Why to buy Mercedes to drive only 30km/h speed everyday to local shop and nothing else?
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top