USB to RS232 adapter


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    That was pretty quick!

    I've been playing with the program here and can say that the two PAUSE 25 statements, have to GO.

    Of course that messes up the LED's, but with the pauses in there, it only picks up every 7 or 8th character when sending continuous data.

    Without them, it works pretty good, but it's still a bit slow.
    Test data of about 1500 bytes takes nearly 3 times as long as it should. Around 1.2 sec.

    I think circular buffers would help speed it up, since it has to wait till it's finished sending the HSEROUT before in can receive more data from the USB. But I guess that depends on how fast you need it to be.

    DT

  2. #2
    Join Date
    Jan 2006
    Location
    Toronto
    Posts
    109

    Default

    Thanks Darrel. I have eliminated the LEDs all together because there is really no need for them. I was testing it by just using a terminal program on 2 computers so I never noticed the speed problem till now. How do I impliment the circular buffers you mentioned?

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Me and my big mouth.

    I wish I had time to work something up, but I've got too many things going on already.

    You might take a look at this post by Joe S.
    http://www.picbasic.co.uk/forum/showthread.php?p=28233

    He's got a buffer in there for serial RX. Should give you a start.
    But you really need to buffer both RX and TX.

    busy busy,
    DT

  4. #4
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Default

    Hi Guys I've been working on the same - I can get a Half duplex data communication going but not full duplex (rs232-> usb and vice versa).

    This program seems to do the trick, but even with the pauses removed I still only achieve a stable data rate at 9600 when sending large text files.

    I'll try using the DT method (DT_int_18) interrupts and see if this speeds things up.

    Circular buffers? The mind boggles!

    Cheers

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    i doubt it would be if you used the EUSART but may worth to try..

    PicMultiCalc gaves me...
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 225 ' 9600 Baud @ 48MHz, 0.0%
    SPBRGH = 4
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    mixing INT_18 and asm would certainly have some great effect.
    Last edited by mister_e; - 26th February 2007 at 03:33.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    I can get a Half duplex data communication going but not full duplex
    USB is a Half-Duplex protocol. There's no way to have TRUE full-duplex. 2-wires, differential levels, can only do one thing at a time.

    However, with the proper buffers in place, you can make it seem like it's "FULL", in that you can send and receive at the same time from the USART. But it never truely will be Full-duplex for the USB.

    DT

  7. #7
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Default

    Yeah your right,

    I guess what I should have said was this.

    I can transmit in only one direction usb->usart, or usart->usb, not in the same program. Never mind now. I'm confused... ;(

    Using Int_18 has def. sped things up!

    Now I can transfer from USB->Usart successfully at 57600 baud, however Usart->Usb still only good enough at 9600 when sending text file. (Sending single key strokes is fine both directions at any speed).

    I figure that the usart buffer needs to be increased as this is the bottle neck.


    Cheers

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. USB to rs232 emulator
    By Pic2008 in forum USB
    Replies: 0
    Last Post: - 5th March 2010, 15:54
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  4. Bafo USB to serial adapter
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 29th July 2006, 18:48
  5. USB to Serial Adapter with 9.6v
    By serandre in forum Serial
    Replies: 3
    Last Post: - 10th May 2006, 20:16

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts