Problem on rs-232, help

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Problem on rs-232, help

Beitrag von Maxiq4 » Freitag 25. Dezember 2009, 19:34

Im NOT found any solution about this problem.
someone help me pls.

when I use rs-232 "com receive string" module on the serial port,
several times later (some 1 minute, some 5 minutes , 10 minutes),
data value erratic reading on the screen !
like profilab buffer is full ,
when I close program and run again, its perfect ,than again ..than again.

if I use higher baudrate like 34800 or 56000, problem starting more quickly ,
when I use "slow" setting on the (right-up screen button) problem starting very very quickly .
I say again ,close and run again ,program good ,,then again erratic .

* Im send a number string from microcontroller ,
0 to 1000 count, its simple.

really I found a solution :cry:
Im trying and trying , I cant anything...
maybe we can add a buffer ?
maybe use another xxx something I dont know...

If you want, I can send this post german language ,

thanks

Im create a sample video
this is 38400 baudrate and slow setting ,
Im stop and start program again
http://www.youtube.com/watch?v=Os6gC5MOFBA

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Freitag 25. Dezember 2009, 21:06

Hi,

i think this is no buffer problem. Its more a problem with separating the String in Profilab. The "com Receive Module" thinks your string transmission is compleate while receiving a 13 or 10 or 13 10, its dosnt matter if this is a measure value. Look into settings in com receive module at "separtion sign" or similar, i dont know the exact englisch expression.
For more help, please upload your projekt.

Please take a look to download/file.php?id=354

You can learn how to transmit and receive your strings quite save. Also Possible with µC. Simple transmit your string twice, separated by a ~ sign. In Profilab, separate String, compare it together an hold always your last valid String, if compared string ok, separate your transmit values ( | sign ] with the $part to your diffenerent meassure value.

Value 1 25568
Value 2 11,55
Value 3 hello
Sample of receive Sting.

25568|11,55|hello~25568|11,55|hello
stachlige Grüße, Kaktus

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Samstag 26. Dezember 2009, 18:08

dear kaktus ,
really thanks your interesting .

Im trying understand you upload files.

here my test project ,
http://rapidshare.com/files/326188095/s ... t.prj.html
could you check ?

I want to say again ,
if I run it slow speed, values going crayz after 3 seconds
if I run it fast speed, values going crayz after 1 or 1,5 minutes later.
and scale is very fast, fast speed ..

regards

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Samstag 26. Dezember 2009, 18:25

Dear Maxiq4,

you can upload your project in this forum!

to help you, i need more information about your µC.

How is he sending the bytes? Can you catch some bytes with terminal programm?
What kind of µC AVR PIC?
Can you upload sourcecode?
stachlige Grüße, Kaktus

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Samstag 26. Dezember 2009, 18:43

I think the problem is:

Your µC is sending your values in Hex . And the Problem is, that sometimes the µC is sending the Value $3a HEX , the : sign.

Its better he is sending numbers for the value 0-9 (hex 30- 39 ) , so never sending 3a HEX as value !!!

Looks like this in COM $ output: ( 55,12323 is your 1stvalue 23355 your 2nd )

55,12323:23355

Then you need NOT the &VAL Modul !
stachlige Grüße, Kaktus

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Sonntag 27. Dezember 2009, 16:05

KAKTUS hat geschrieben:I think the problem is:

Your µC is sending your values in Hex . And the Problem is, that sometimes the µC is sending the Value $3a HEX , the : sign.

Its better he is sending numbers for the value 0-9 (hex 30- 39 ) , so never sending 3a HEX as value !!!

Looks like this in COM $ output: ( 55,12323 is your 1stvalue 23355 your 2nd )

55,12323:23355

Then you need NOT the &VAL Modul !
hi kaktus .
but I already use ":" when sending for seperate two value .
maybe I dont understand to you exactly ?
what do you mean, could you explain again ?

sorry , I know english but not perfect .
also thanks to &VAL modul, Im remove it, I dont know why I use !

regards

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Montag 28. Dezember 2009, 13:50

Im trying upload file to forum
Dateianhänge
serial_test.prj
(2.42 KiB) 401-mal heruntergeladen

Mike D
Beiträge: 528
Registriert: Dienstag 14. Oktober 2008, 14:48
Wohnort: Elbe- Weser-Dreieck

Re: Problem on rs-232, help

Beitrag von Mike D » Mittwoch 30. Dezember 2009, 09:21

Clocking the COM with PON and loop back is unsave and stops in case of error.
Try clocking with a Tacktgenerator and chose a clock higher than the sendrate of the µC.
Overclocking of the COM is no problem.

Mike

abacom
Site Admin
Beiträge: 3917
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Re: Problem on rs-232, help

Beitrag von abacom » Montag 4. Januar 2010, 11:09

Not long ago, I ran into trouble with an µC project transferring RS232 data with 115200 baud.
(ATMEL ATMEGA; fCLK=16.000 MHz)

As the µC generates the baud rate from its system clock (16 MHz) by clock division, the 115200 baud could not be generated exactly, but with some percentual error. This causes my PC´s (USB-) RS232 to hang up from time to time.

Finally I changed the µC system clock to 18.432 MHz (crytal and software). This frequency allows all baud rates to be generated with 0% error. Since that the communication worked perfectly.

May be this is not the solution for the actual problem, but I found it important enough to be mentioned.
ABACOM support

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Montag 4. Januar 2010, 17:06

@Maxiq4

Some News?
stachlige Grüße, Kaktus

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Mittwoch 31. März 2010, 12:32

really really sorry for very delayed answer ,
especially from kaktus.

no any change, no any solution already ,
serial goes crazy always
Im change usb to serial cable
Im trying another pc
Im trying another baudrate

but Im remove PON then trying "pulsgenerator" now.. (1000hz)

result coming soon ..
its working like

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Donnerstag 1. April 2010, 14:43

hello ,
yes pulsegenerator better than PON input ,
but its goes crazy finally ,after 10 or 15 minute, sometimes half hour, but same ..

PON input , after 2 minute only sometimes 5 minutes .

if use slow speed in the PL (its on the right up corner)
goes crazy very quickly ,
fast better, but its use very high cpu load.

so ,
if I use hyperterminal in windows xp ,
NO ANY problem,never.
Im just wait 1,5 hour and already working good .

dear abacom,
it is not only my problem I think,
could you found any solution ?

thank you

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Donnerstag 1. April 2010, 15:04

To less informations to help you.

1. Please upload your last prj File in Forum
2. Please write something about your µC an post sourcecode/ sheet
3. please use Hterm http://www.der-hammer.info/terminal/index.htm an send us a Log Text what the µC is sending
4. Look for errors in YOUR projects
stachlige Grüße, Kaktus

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Donnerstag 8. April 2010, 23:42

KAKTUS hat geschrieben:To less informations to help you.

1. Please upload your last prj File in Forum
2. Please write something about your µC an post sourcecode/ sheet
3. please use Hterm http://www.der-hammer.info/terminal/index.htm an send us a Log Text what the µC is sending
4. Look for errors in YOUR projects

hi kaktus,

1. Here is the prj file
http://rapidshare.com/files/373624918/s ... t.prj.html

2. Im use 18F2525 microchip pic microcontroller, its work 16Mhz
using hardware serial port and 19200 baudrate .
Im send serial out data aprox 25 times per second .

code is simple
numbers are increase up to 1000 then goes to zero, than count again.

Code: Alles auswählen

LOOP:
Inc TEST1
Inc TEST2
Inc TEST3
Inc TEST4

If TEST1>1000 Then TEST1=0
If TEST2>1000 Then TEST2=0
If TEST3>1000 Then TEST3=0
If TEST4>1000 Then TEST4=0

HRSOut "|",Dec TEST1,"|",Dec TEST2,"|",Dec TEST3,"|",Dec TEST4,13,10

DelayMS 20      
GoTo LOOP
3. half hour log file is here.
http://rapidshare.com/files/373622257/o ... 7.log.html

4. I think no error serial out, because its working good with windows hyper terminal.
Im use just two pin, ground and transmite.


thanks

abacom
Site Admin
Beiträge: 3917
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Re: Problem on rs-232, help

Beitrag von abacom » Freitag 9. April 2010, 08:38

Likely an input buffer overrun, due to sending too fast.
At least a timing problem. Working perfect under "normal" conditions, but...
think of other background processes, that may interrupt or delay receivement
(e.g. network traffic, virus scans, etc.)
What if PL can not fetch data early enough? Well, there is an input buffer,
but even that can be overrun. Try 100ms delay between broadcasts.
ABACOM support

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Freitag 9. April 2010, 13:10

to 1.
Thanks for your file, but no rapidshare is nedded. You can upload your files in this forum.
I have changed your project a little bit and added a MWR.

to 2.
Not every crystal is qualified for serial baud rate generation. There are special crystal to produce less baud rate errors. 16 MHz is not qualified, but normally it should work with 19200baud.
http://www.microchip.com/forums/tm.aspx ... 0%AB%B2%93

Your Code looks god, a small error i find
HRSOut "|",Dec TEST1,"|",Dec TEST2,"|",Dec TEST3,"|",Dec TEST4,13,10
Change it to
HRSOut Dec TEST1,"|",Dec TEST2,"|",Dec TEST3,"|",Dec TEST4,13,10
so you can use in Profilab $part the first Output.

You can remove DelayMS 20 , normally it works without.

to 3.
Tip. You can upload a log as zip in this forum.

to 4.
OK, i can see no errors, normally it should work with Profilab also.

Question 1:
Did you run your project in FAST or SLOW Mode? You should try FAST

Question 2:
Try higher baud rate like 38400, better?

Qustion 3.
Please report more about your PC, operating system, CPU, did you use RS232 -> USB adapter ?
I append a new file with a new component called MWR. This saves all received data in C:\Program Files\ProfiLab-Expert40\Data\MWR.TXT
Your installation path from your Profilab.


Please try this new settings an upload mwr.txt as zip in this forum.

Maybe its better always sending the same, because its easier to find errors in mwr.txt

LOOP
HRSOut "1001|1002|1003|1004",13,10
GoTo LOOP

I tried this with my AVR @19200, no problems
Dateianhänge
kaktus_serial_test.prj
(3.34 KiB) 333-mal heruntergeladen
stachlige Grüße, Kaktus

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Sonntag 18. April 2010, 09:58

hi kaktus ,

Im take error with 10mhz crystal also .

Im use your code and remove delayms 20
HRSOut "1001|1002|1003|1004",13,10

than upload logs forum,
with 19200,38400, and 4800 slow and fast settings
when speeds up , problem exist easly .
no any error with 4800 baudrate half hour .

Im take error another notebooks,
Im use other usb-serial converter
and no any error with xp hyper terminal with 19200 and slow setting .

thank you
Dateianhänge
Data.rar
(57.49 KiB) 328-mal heruntergeladen

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Sonntag 18. April 2010, 11:06

hi Maxiq4

NO problems at 4800 Baud
Im take error with 10mhz crystal also
10 Mhz is also not qualified.

I think, its a mismatch with your crystal to baud rate frequency.
You should try an other Crystal to get less errors on RS232. You have also an internal oscillator, maybe it haves useful frequencies ?

Please play with the settings:
http://www.piclist.com/techref/microchi ... 592&fErr=0
If there are errors in receiving in profilab, try this (very nice terminal programm)http://www.der-hammer.info/terminal/ and compare if there are also errors.
stachlige Grüße, Kaktus

Maxiq4
Beiträge: 24
Registriert: Sonntag 2. November 2008, 17:23

Re: Problem on rs-232, help

Beitrag von Maxiq4 » Montag 19. April 2010, 06:03

hello Kaktus ,
I want to ask a question ,

why I take no error on windows hyper terminal and your Hterm.exe ?

KAKTUS
Beiträge: 651
Registriert: Samstag 18. Oktober 2008, 21:12

Re: Problem on rs-232, help

Beitrag von KAKTUS » Montag 19. April 2010, 11:07

its not my hterm ;-)

You have to ask the programmers. I don't no. But hterm is really good, i haven't any problems with it.
stachlige Grüße, Kaktus

Antworten

Zurück zu „Thema RS232“