PIC-to-PIC HSEROUT/IN


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429

    Default PIC-to-PIC HSEROUT/IN

    I want to send data from one PIC to another using HSEROUT/HSERIN, so as a first step I figured I would just send 1 byte and go from there. But i'm not getting the same byte out that i put in.

    Transmit:
    Code:
    ' PIC = 18F4550, 4Mhz External OSC, PLL results in OSC of 48Mhz
    
    DEFINE OSC              48
    
    DEFINE HSER_TXSTA       24h
    DEFINE HSER_RCSTA       90h
    DEFINE HSER_BAUD        2400
    DEFINE HSER_SPBRG       25
    DEFINE HSER_BITS        8
    
    ADCON1=%00001111
    
    main:
    HSEROUT [$47]
    pause 10000
    GOTO main
    Recieve
    Code:
    ' PIC = 18F1320, 20Mhz External OSC
    
    DEFINE OSC              20
    
    DEFINE HSER_TXSTA       24h
    DEFINE HSER_RCSTA       90h
    DEFINE HSER_BAUD        2400
    DEFINE HSER_SPBRG       25
    DEFINE HSER_BITS        8
    DEFINE HSER_CLROERR     1
    
    ADCON1=%01111111
    
    DEFINE LCD_DREG         PORTA
    DEFINE LCD_DBIT         0
    DEFINE LCD_RSREG        PORTB 
    DEFINE LCD_RSBIT        2
    DEFINE LCD_EREG         PORTB
    DEFINE LCD_EBIT         3
    DEFINE LCD_BITS         4
    DEFINE LCD_LINES        2
    DEFINE LCD_COMMANDUS    2000
    DEFINE LCD_DATAUS       50
    PAUSE 500
    
    data_in                 VAR BYTE
    
    LCDOUT $FE,1,$FE,2
    
    main:
    data_in=0
    HSERIN 500,main,[data_in]
    LCDOUT HEX data_in," "
    GOTO main
    Some tests:
    Code:
    sent   recvd
    $47    $F9
    $01    $F8
    $FF    $FF
    $E9    $FE
    $AA    $FE
    I'm lost as to what i've done wrong. Any ideas?

    *edit* it must be something wrong with my transmit code, because using SEROUT2 instead on the transmit side works - but i need to use HSEROUT. Still lost.
    Last edited by Kamikaze47; - 13th August 2008 at 15:51.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    My SPBRG values were wrong.

    Got it working, and learned something in the process = win.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. Replies: 67
    Last Post: - 8th December 2009, 02:27
  3. 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
  4. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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