Shop OBEX P1 Docs P2 Docs Learn Events
Basic Serout Problem — Parallax Forums

Basic Serout Problem

heroldherold Posts: 66
edited 2005-07-29 00:08 in General Discussion
I am using a simple program to output "Hello" in a loop (see attached program). Pin RB1 is connected to RX on the USB2SER chip. VCC is connected from the board to Vcc on teh USB2SER chip.

In my PC I am using the DDL driver to read the data. I am using the same Baud rate and connection settings but the data come in as unreadable characters.

I was testing a loopback with the USB2SER and the characters I send come exactly the same way back.

Is there anything I am missing here?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-28 19:30
    I've attached my version of your program -- it takes advantage of SX/B features.· What you'll find is that SEROUT expands into a fair chunk of code, so embedding it into a subroutine is a good idea for saving money and giving you additional flexibility.· I used HyperTerminal to test and it worked first time.

    Connections:
    · RB.1 --> USB2SER.RX
    · Vss· -->·USB2SER.VSS

    Make sure you have the latest FTDI VCP drivers installed on your PC -- you need that for the USB2SER to work properly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 7/28/2005 7:37:41 PM GMT
    861 x 574 - 62K
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-28 19:55
    Since I had everything hooked up I thought I'd share a teaser for version 1.4 (coming in a couple weeks) -- it will let you embed strings and trasmit them with farily-straightforward code.· The compiler takes care of generating the data for an inline string and addressing for both inline and strings stored in DATA statements.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • heroldherold Posts: 66
    edited 2005-07-28 20:49
    Hello Jon,

    Thanks for the program. Well, with your program it works! And I found out why. It's the characters 13 & 10 on the end of the string Hello. Without them I get unreadable characters. Why do I need to send this characters?

    What would I do to send random bytes to the serout? Would I send a string of 128 bytes and than end it with characters 13 & 10?
  • heroldherold Posts: 66
    edited 2005-07-28 21:30
    Hello Jon,

    Cool, just what I need. I use version 1.31 of the compiler but get lots of error messages. Do I have to wait until the new compiler comes out for using your program?

    Is sending characters 13 & 10 after a string part of the serial protocol?

    Post Edited (herold) : 7/28/2005 10:02:00 PM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-28 22:06
    I don't know what program you're having trouble with, so I can't explain why adding CR and LF to the end of the string is helping you. Had I not put those characters into my "Hello" program then it would have filled the screen without the linefeed in between.

    You can't compile the strings program yet -- it requires 1.4 and only two of us have it. We're still testing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • heroldherold Posts: 66
    edited 2005-07-28 22:35
    Hello Jon,

    I used a simple test program to write "Hello" into the USB2SER and then read it again. I did this by making a loopback connecting RX & TX.

    I may have to clearify this with the support of the FTDI people.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-28 23:47
    Have a look at this thread: http://forums.parallax.com/showthread.php?p=541850

    There is code within that exchanges data between a PC and the SX via the USB2SER adapter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • heroldherold Posts: 66
    edited 2005-07-28 23:52
    Hello Jon,

    Yes, of course this is my thread where everything started. But it doesn't work that way as Bean provided in his code as I am missing the 13&10 characters on each end.

    I would have to send one byte and than 13&10 which is a waste of space. I guess I need to send packages of let's say 256 bytes and than send 13&10 to end this package.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-29 00:08
    Well, as was determined in the other thread -- the problem is in your PC application.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.