Issues sending and receiving data


Results 1 to 20 of 20

Threaded View

  1. #1
    Join Date
    Jul 2024
    Posts
    28

    Default Issues sending and receiving data

    Hi guys,

    I'm trying to send/receive data between 2 PICs on the same circuit.
    The first one (16F1508) is sending data with debug command.

    Code:
    INCLUDE "modedefs.bas" 
    
    DEFINE DEBUG_REG PORTA             ' Set Debug pin port
    DEFINE DEBUG_BIT 2                ' Set Debug pin bit
    DEFINE DEBUG_BAUD 2400            ' Set Debug baud rate 
    DEFINE DEBUG_MODE 0                ' Set Debug mode: 0 = true, 1 = inverted
    
    
    PreAmble     CON     $A5
    
    
    debug PreAmble,$af,$c2,$b5,$ef,13,10
    The second one (16F1503) is receiving the data with debugin command.

    Code:
    INCLUDE "modedefs.bas" 
    
    DEFINE DEBUG_REG PORTC             ' Set Debug pin port
    DEFINE DEBUG_BIT 2                ' Set Debug pin bit
    DEFINE DEBUG_BAUD 2400            ' Set Debug baud rate 
    DEFINE DEBUG_MODE 0                ' Set Debug mode: 0 = true, 1 = inverted
    
    
    DEFINE DEBUGIN_REG PORTA        ' Set Debugin pin port 
    DEFINE DEBUGIN_BIT 1            ' Set Debugin pin bit  
    DEFINE DEBUGIN_BAUD 2400        ' Set Debugin baud rate (same as Debug baud) 
    DEFINE DEBUGIN_MODE 0            ' Set Debugin mode: 0 = true, 1 = inverted 
    
    
    Main:
    DEBUGIN 1000,timeoutlabel,[WAIT("$af"),DAT1,DAT2,DAT3]
    pause 3000
    
    IF DAT1=$c2 THEN
    GOTO SELECTION
    ENDIF
    
    
    
    goto main
    
    
    timeoutlabel:
    debug DEC 99,DAT1,DAT2,DAT3,13,10
    pause 3000
    
    
    goto main
    The data validation fails and the code jumps to the timeout label.

    The timeout label is sending the received information out for troubleshooting purposes.
    For troubleshooting I'm using a Microchip Pickit serial analyzer.

    The information sent is different from the information received.

    This is the data sent from PIC #1 and captured with the analyzer:

    Code:
    [00][A5][AF][C2][B5][EF][0D][0A]
    And this is the data sent from PIC #2 (when in timeoutlabel) and captured with the analyzer:

    Code:
     [4E][4E][BF][79][0D][0A][00]
    Why is the data different? The only data that seems to be correct are the carriage return bytes.
    What am I doing wrong?

    Thanks
    Last edited by PaulMaker; - 28th October 2024 at 19:39.

Similar Threads

  1. SERIN2 Receiving Wrong Data
    By rsocor01 in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 4th May 2024, 20:31
  2. how to display data receiving from xbee to LCD
    By NURULHAIZA in forum mel PIC BASIC
    Replies: 2
    Last Post: - 19th November 2010, 21:24
  3. Sending/receiving data using Linx modules
    By Goat 403 in forum Serial
    Replies: 3
    Last Post: - 21st May 2009, 13:57
  4. Receiving and Transmitting Serial data at the same time
    By BobP in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th April 2007, 22:00
  5. Receiving data from more than one serial Port
    By PICtron in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th March 2005, 10:20

Members who have read this thread : 15

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