Hardware comms on 16F877A and 18F4550 to PC


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Hardware comms on 16F877A and 18F4550 to PC

    I've forgotten the answer to this one...

    I'm using the hardware comms on these pic's to send diagnostics data back to laptop.
    Except i get hieroglyphics in realterm as follows...

    Code:
    [z'-KL^Z='-y[:jӯ
    This is supposed to say "initialising"
    Code:
    HSEROUT ["Initialising",10,13]
    off the top of my head i can never remember, but is the hardware comms on PIC's inverted compared to a normal RS232 port?
    If so, would the 'software' inversion sequence be 255 - (the dec number of the ascii conversion for the character)?

    Yes, i do have a max232 that i could use, however, the 'serial port' is actually a cheep USB to serial adapter that uses 5V outputs so a max232 wouldn't properly work...

    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    I've used a max232 on what I thought was a cheap 5 volt usb adapter, and it did work. Now I have to check on an oscilloscope to make sure it was as cheap as I thought.

    Since you are just at ttl levels you could do this trick with the 18F4550 without a max232, but you are SOL without a max232 on the 16F devices.

    Code:
    @ BSF BAUDCON,RXDTP
    @ BSF BAUDCON,TXCKP
    Last edited by ScaleRobotics; - 27th June 2010 at 03:07.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    the USB to serial adapter is giving me 5V on the control lines (RTS, DTR) so i'm assuming it's a cheep and nasty..

    Having said that, now that i've had some sleep... i could write a pic program to sequentially spit out 0 to 255 (DEC) and use realterm to display the binary of what it receives... this will tell me if it's a hardware setup problem or if it's an inversion problem (or both). i'm also going to drop the baud to something ridiculously low... realterm does bauds as low as 110...

    I'm going to be putting in an order with crownhill for a load of 18F4550's probably towards the end of the week along with some other items and wire etc...

    What i want is not to use HSER commands and use an interrupt based comms handler, but untill i sort this problem...

    thanks

  4. #4
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by comwarrior View Post
    this will tell me if it's a hardware setup problem or if it's an inversion problem (or both).
    It is definitely inverted. The UART expects you to use a max232 to talk to a computer. That is, unless you set the bits I showed you. To help eliminate a possible setup issue, you can set the baud using this calculator: http://www.picbasic.co.uk/forum/cont....-PICMultiCalc .

    What i want is not to use HSER commands and use an interrupt based comms handler, but untill i sort this problem...
    Using the UART is the best to use with an interrupt. It has a buffer, and it's own interrupt.

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by comwarrior View Post
    the USB to serial adapter is giving me 5V on the control lines (RTS, DTR) so i'm assuming it's a cheep and nasty..
    Comwarrior, What are you doing with the CTS(clear to send) line? If the RTS(request to send) and the DTR(data terminal ready) line from the usb are active it's ready to play. If you are only using 3 wire serial comm then, tie the DTR to the CTS line which will tell the USB that the pic is ready to send data. Also make sure the PC side has handshaking turned off.. As far as RX & TX polarity goes, when the serial bus is IDLE both RX and TX should be at +5 volts... You can check this with a meter...

    Dave Purola,
    N8NTA

  6. #6


    Did you find this post helpful? Yes | No

    Default

    i wired up a max232 and she's behaving now... well, i'm receiving the initialisation txt's...

    However i have another problem now... but i'll start a thread in pbp for it since it seems to be software... i hope

Members who have read this thread : 1

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