PIC to PIC TX RX and PIC to PC COM RX ..a little help please


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    For PIC to PIC Debug is not the way. SERIN is good for basic stuff. SERIN2 has a whole lot more options and uses the same syntax as HSERIN when you need it. The nice thing about the SERIN/2 is it can be set for TRUE or INVERTED while HSERIN is TRUE only requiring an inverter to connect to things like a PC, but that is a minor thing with the other benifits of hardware serial.

    http://www.melabs.com/resources/samples.htm
    Scroll down to the ser2mod examples for...examples....

    When it comes time to idle low or high that can be done with a resistor 100K. Or in your code.
    Dave
    Always wear safety glasses while programming.

  2. #2


    Did you find this post helpful? Yes | No

    Default OK so suggested method for TX RX is of choice is ...

    SERIN2
    or
    HWSER right ?

    You mentioned being able to set the IDLE in software if I am going to be using SERIN...
    That's what I was asking in the last post :-)

    In the post you pointed me to it mentions the issues/problems with SERIN and to set it IDLE ...
    SO my question is how do you set the IDLE using software ?

    Is there a document regarding the IDLE setting methods ?

    Kind regards

    Dennis

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Normally the mode takes care of the idle state
    http://www.picbasic.co.uk/forum/show...92&postcount=7
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I hate to sound like a broken record - but... Always use the hardware serial port if your device has one. You will be glad you did.
    Charles Linquist

  5. #5


    Did you find this post helpful? Yes | No

    Default hmm...

    Thanks Dave and Charles :-)

    But where do I start with hardware ports?

    I got the impression reading through the forums that software serin/out and serin2/serout2 and debug would be easier to play around with.
    I ssetting up the hardware option just as easy ?

    I also read somewhere that serin needs to be setup to look for something first before it starts accepting data ? Is this why I after one keypress, nothing else appears on the LCD ?

    Is there a some code I could use just to test the TX/RX function between 2 PIC's using wires ( see my diagram in earlier posts) , once I have that working I can then move onto TX and RX using wireless

    Something like setup PIC A to send a string or a byte to PIC B and then have PIC B send the same byte to hyperterminal(pc).

    Could I use serin2 first then serout (not serout2) to send the string or byte to hyperterminal(pc).

    Have I made the correct choice for send and receive ports ..on both pics PORTC.6 and PORTC.7

    Any help or advice would really be appreciated.

    Kind regards

    Dennis

  6. #6
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default RS232 Comms

    Dennis,

    A few thoughts on linking PICs by RS232:

    1. I've done it - unfortunately, deleted the code after getting it working.

    2. I used SERIN2 and SEROUT2, by habit rather than for good technical reasons.

    3. HSEROUT/HSERIN do pass much of the processing down to the chip hardware and save lots of processing time and code space. However, if you are still in the 'getting something working stage' I'd use SEROUT/SERIN to avoid additional DEFINES and so on needed for HSEROUT/IN.

    4. I've had a short read through your code and not spotted any problems. I'd suggest that you temporarily abandon the keypad business and write a very basic routine to send/receive one byte variable PIC-Hyperterm and then PIC-PIC. Start using SEROUT/SERIN then move on to SEROUT2/SERIN2 and then HSEROUT/HSERIN.

    5. Have you got carriage returns (Decimal '13') at the end of each transmission?

    6. I've not looked up the data for your chips but what is TRISX?

    7. Just had a longer look at the code and I think your sequencing is wrong? Should be:

    a. PICA. Press key
    b. PICA. Send to the other PIC (I think you receive here?)
    c. PICB. Receive data
    d. PICB. Send data
    e. PICA. Receive data
    f. PICA. Display data on LCD
    g. PICA. Press key......

    Watch those CRs!

    8. I assume that each end of the PIC to PIC RS232 link is symetrical i.e both have RS232 chips for level conversion or both do not?

    Regards Bill legge

  7. #7


    Did you find this post helpful? Yes | No

    Default thank you Bill

    Hi Bill

    Thanks a million for the informative response and advice :-)
    Here is my reply to your examination :
    1.Damn, just my luck ! Nice to hear you came right though :-0
    2.I wouldn't mind using either have those but found issues with serout2 and the data displayed in hyperterminal so used serout.
    What are your thoughts on using DEBUG ?
    3.I did notice in reading through other forum posts and the manual that DEFINES are required.
    4.I was thinking of doing exactly the same thing just to remove also possible room for error :-)
    5. No I do not have carriage returns at the end of each transmission are you referring to 10,13 at the end of serout ?
    I was under the notion that I could just SEROUT ping and port at 2400T and the variable name all in a loop.... is this where my problem is...apart from being a little rusty and having to re-live been a PIC newbie again ?
    6.TRISX is a very secret register which you enable my moving the shift in the time space continum on a PIC 18f4520 ....:-) lol just kidding.
    OK jokes aside TRISX is the comment I placed there so that I could remember how to manipulate TRIS for IO.
    7. Sequencing is correct ...just realised I have not added the connection diagram :-( will add it to this post now.
    I am sending from PIC 16f887 PIC 18F4520
    PORTC.6(TX)-----PORTC.7(RX)
    PORTC.7(RX)-----PORTC.6(TX)
    so it's PIC16F887 >>PIC18F4520 >>PC(hyperterminal)
    out in | out
    TX RX | TX
    |
    LCD IS HERE (wired to 18F4520)
    Once again ...where are the CR's and where should they go exaclty ?
    8.The only place there is a MAX232N is on the TX side of the 18F4520 so that is can connect to PC serial port, in which case I am able to send and receive data to and from the PC :-)

    Hope this helps , will post more info just now to make it simpler to read ;-)
    Any more info would be much appreciated.

    Kind regards
    Dennis

Similar Threads

  1. Direct PIC to PC without MAX232
    By acjacques in forum Serial
    Replies: 14
    Last Post: - 23rd October 2014, 21:32
  2. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  3. PIC or xbee times out after Tx 504 bytes
    By archendekta in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd November 2009, 08:45
  4. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  5. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13

Members who have read this thread : 2

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