Lost in Pic to Pic communication


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2006
    Posts
    14

    Default Lost in Pic to Pic communication

    hi,there i am now stuck with pic to pic communication i am using the same crystal for both the microcontroller board i try to send some byte to another pic i use the simulator to monitor the transmit data they look find for me ,but when i program and run it through the hardware i got no response fom another one could some one pls help out? thanks

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    You could post the code. For us is that better to gess.
    Otherwise we can say: You forgot to power on the processors.

  3. #3
    Join Date
    Apr 2006
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    I am using the oshonsoft pic basic pro to write the code my Rx and Tx code are as follows:
    (Transmit)
    Dim a1 As Byte
    Dim temp1 As Byte
    EEPROM 21, 4

    scan:
    If PORTA.2 = 0 Then
    Gosub loop
    Endif

    Goto scan

    End

    loop:

    WaitMs 50
    Serin PORTC.1, 9600, temp1 'Rx port 8
    Serout PORTC.0, 9600, #temp1
    'Write 21, a1
    If temp1 <> 0 Then
    a1 = temp1
    Write 21, a1
    Gosub menu
    temp1 = 0

    Endif

    Return

    (Receive)

    main:
    Read 21, a1
    Lcdcmdout LcdClear
    Lcdcmdout 0xc0
    Lcdout #a1

    If PORTA.3 = 0 Then
    PORTC.2 = 1
    Serout PORTC.1, 9600, #a1
    a1 = a1 + 1
    Write 21, a1
    PORTC.2 = 0
    Endif
    WaitMs 1000
    Goto main
    end

    ************************************************** ********
    i manage to see the output from the simulator for my Tx routine ,i am sure the data is sending out but the receiver site can't receive it.why?

  4. #4
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Normaly is a receive done with a serin command and a transmit with a serout command.

  5. #5
    Join Date
    Apr 2006
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    i already correct the Rx and Tx ,but still cannot ,is it neccessary for me to use HARDWARE USART?

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


    Did you find this post helpful? Yes | No

    Default

    i'm just affraid about your baudrate definition here

    Code:
    Serin PORTC.1, 9600, temp1 'Rx port 8
    9600??? This value is wrong, the calculation is explain in your manual. @9600 bauds, 4MHZ crystal may work or not. Another thing, we don't know your PIC model, it may exist some analog stuff on PORTC... refer to your datasheet for that.

    also by seeing.. those lines...
    Code:
    Dim a1 As Byte
    .
    .
    .
    WaitMs 50
    it sounds to me that you use PROTON instead of Melabs PICBASIC. Sorry dude, you're on the wrong forum. www.picbasic.org/forum
    Steve

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

  7. #7
    Join Date
    Apr 2006
    Posts
    14


    Did you find this post helpful? Yes | No

    Post

    I am not using proton ,my basic compiler is from this www.oshonsoft.com
    i choose this "PIC Simulator IDE" because it builds in alot of simulator tools,so that i can easily debug my program,its format is quite different if compare to MELAB Pic Basic pro.But it still uses them.

    All its keywords can befound here:http://oshonsoft.com/picbasiccompiler.html

Similar Threads

  1. 2 PIC, serial communication
    By lightgreen in forum Serial
    Replies: 6
    Last Post: - 21st November 2009, 15:20
  2. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  3. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 01:56
  4. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45
  5. Pic to Pic communication?
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2004, 19:41

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