USB/RS232

Problems with USB/RS232 converter.
The microcontroller sends this every second with 9600 8 N 1:
20111
20122
20222
20233
20333
20344
20444
20455
20555
20566
20666
20677
20788
20888
20899
20999

When using a ST-LAB USB / RS232, Textfield1.text looks like this:

20111??20122??20222??20233??20333??20344??20444??20455??20555??20566??20666??20677??20788??20888??20899??20999
next second:
20111??20122??20222??20233??20333??20344??20444??20455??20555??20566??20666??20677??20788??20888??20899??20999
next second:
20111??20122??20222??20233??20333??20344??20444??20455??20555??20566??20666??20677??20788??20888??20899??20999
…
and that’s okay

However, when any other 232 / USB converter is used, Textfield1.text looks like this:
0899??20999
after the next second:
0899??20999
after the next second:
6??20677??20788??20888??20899??20999
after the next second:
??20999

Does not figure out why there is a difference between some USB / RS232 converters.

Any ideas?

Yessssss

St.lab usb is based on Prolific pl2303 chip and have buffer.
128-byte outbound buffer and 384-byte inbound buffer
other model without this chip is possible no have buffer.

other : check cable connection for RTS (Request to Send) and CTS (Clear to Send) pin 7 and 8 of 9 pin rs232 serial connector ( cannon 9 pin ) and/or pin 4 and 5 of 25 pin rs232 connector.
Normally the pin is no bypassed ( 7 and 8 welded for 9 pin rs232 ).

I hope you can understand my English with macaroni

I had the same problem with a truck scale. I had used a moxa rs232 to UDP converter. when I connected the 7/8 pin and turned off the buffer, I did not have any more problems.

Those ?? are most likely an end of record marker (probably or &h0D0A) and you should be treating them as such while most likely discarding the first packet.

Review https://blog.xojo.com/2015/03/23/guest-post-serial-communications-with-xojo/ to see how to do this.

?? do not make any problem. I use the part of the string I need.

I do not have any 7/8 pin, and in one of them only 0V,5V, and tx/rx

[quote=352075:@Massimiliano Chiodi]Yessssss

St.lab usb is based on Prolific pl2303 chip and have buffer.
128-byte outbound buffer and 384-byte inbound buffer
other model without this chip is possible no have buffer.

other : check cable connection for RTS (Request to Send) and CTS (Clear to Send) pin 7 and 8 of 9 pin rs232 serial connector ( cannon 9 pin ) and/or pin 4 and 5 of 25 pin rs232 connector.
Normally the pin is no bypassed ( 7 and 8 welded for 9 pin rs232 ).

I hope you can understand my English with macaroni[/quote]

I anderstan but i has to use Google translator too because of my bad english :slight_smile:

I try this but it take som weeks before i got it.
http://www.ebay.co.uk/itm/CP2102-MICRO-USB-to-UART-TTL-Module-6Pin-Serial-Converter-STC-Replace-PB232-JY-/192318135478?epid=854170463&hash=item2cc70ddcb6:g:6kMAAOSwx2dYG~ab

or have any better suggestions…

Note this you got in eBay is a TTL level converter, not RS232! https://electronics.stackexchange.com/questions/274287/what-is-the-difference-between-rs-232-and-ttl-uart

One of the best/cheap adapter i’ve used (not tested with Xojo, but for Linux TTY/Modem/Connect to peripherals) is this one https://www.banggood.com/es/Translucent-USB-To-RS232-Serial-9-Pin-Converter-Cable-Adapter-p-987980.html

If you need more that one, the 5-pack is a bargain.

[quote=352423:@JosMaraTerryJimnez]Note this you got in eBay is a TTL level converter, not RS232! https://electronics.stackexchange.com/questions/274287/what-is-the-difference-between-rs-232-and-ttl-uart

One of the best/cheap adapter i’ve used (not tested with Xojo, but for Linux TTY/Modem/Connect to peripherals) is this one https://www.banggood.com/es/Translucent-USB-To-RS232-Serial-9-Pin-Converter-Cable-Adapter-p-987980.html

If you need more that one, the 5-pack is a bargain.[/quote]

Yes, i have som another to, they now do the job.

Solved.

  1. i change the code in the AVR from (i use Bascom basic on Windows to make Hex file)
    print var1
    print var2

    to
    print var1;var3…

in XOJO i change the code in data available event from
textfield1.text=me.readall (copy from the serial sample in XOJO, barcode reader))

to
if instr(me.LookAhead(encodings.ASCII), chr(13)+chr(10)) > 0 then
Textfield1.Text= Me.ReadAll(encodings.ASCII)
end if

Now all my USB/RS232 is working.

I will use this
http://www.ebay.co.uk/itm/USB-To-RS232-TTL-UART-PL2303HX-Auto-Converter-USB-to-COM-Module-Cable-Wire-MO-/152567614750?epid=2131455778&hash=item2385bd0d1e:g:~HIAAOSwurZZLoFw
and This board
http://www.ebay.co.uk/itm/ISP-ATMEGA16-AT-Mega32-Micro-controller-AVR-Board-Mini-System-DIY-Board-GE-/172160841480?hash=item281595f708:g:~EAAAOSwGYVXB2zE
no more need of the MAX 232,

Thanks folks
http://demmo.saltdal.no/brygging/bryggeri.html

PS. The ST-Lab make my Mac stop rebooting after powerloss, thats why i need another USB/RS232