Synchronous Comms


+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116

    Question Synchronous Comms

    Hi,
    Just a quick question.

    If i wish to send 16 bits of data can i extract 1 bit like this?

    datapin = temp[loop]

    where temp is the word to send, and loop is a for next loop from 0 to 15

    and receive in a similar way

    temp[loop] = datapin

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Bits, Bytes Words and Arrays (melanie)
    http://www.picbasic.co.uk/forum/showthread.php?t=544
    <br>
    DT

  3. #3
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116

    Default

    Thanks for the info Darrel, some very interesting stuff there. Still cant get it to work but I'll keep on trying.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    You may also want to look at the SHIFTIN and SHIFTOUT commands.
    <br>
    DT

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Oops, I see in your other thread you've already tried SHIFTIN/OUT.

    Something like this might be a start...
    Code:
    ; -- Master Transmit --
    For loop = 0 to 15
       datapin = temp.0[loop]
       clkpin = 1
       PauseUS  100
       clkpin = 0
    Next loop
    
    ; -- Master Receive --
    For loop = 0 to 15
       clkpin = 1
       PauseUS  100
       datapin = temp.0[loop]
       clkpin = 0
    Next loop
    ;________________________
    
    ; -- Slave Transmit --
    For loop = 0 to 15
       while clkpin = 0 : wend
       datapin = temp.0[loop]
       while clkpin = 1 : wend
    Next loop
    
    ; -- Slave Receive --
    For loop = 0 to 15
       while clkpin = 0 : wend
       temp.0[loop] = datapin
       while clkpin = 1 : wend
    Next loop
    This way is "Driven" on both ends. Be sure to have a resistor (1K is good) in the Data line between the 2 PICs.
    <br>
    DT

Similar Threads

  1. Serial Comms with PIC micros
    By carlsnilsson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st September 2006, 01:00
  2. Serial Comms Buffer?
    By koossa in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd December 2005, 01:29
  3. Serial comms / Bootloader
    By koossa in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 30th October 2005, 18:48
  4. Pic to Pc Comms
    By Darrenmac in forum General
    Replies: 2
    Last Post: - 21st May 2005, 01:44
  5. Synchronous Comms between Pics
    By AndyP in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th February 2005, 20:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts