Serout with a Word


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Posts
    34

    Default Serout with a Word

    Hi,

    I must be doing something wrong with this, but all I'm trying to do is transmit a Word serially.

    Example:
    TxData VAR WORD
    TxData = %1010101010101010 'Just 16 bits
    SerOut WhatEverTheTxPinIs, T2400, [TxData]

    And all I get at the PC is 8 bits... not the WHOLE word.
    I've seen this done in other examples here, but no cigar for me

    Thanks,
    Tom.

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


    Did you find this post helpful? Yes | No

    Default

    you have to send it one byte at a time. You can chose if you want to send the high or low byte first. Below is an example of sending the high byte first:

    SerOut WhatEverTheTxPinIs, T2400, [TxData.HighByte, TxData.LowByte]
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    I've got it working using:
    SerOut Tx, T2400, [TxData.HighByte, TxData.LowByte]

    But surely I can get it working with just telling it to send the word (TxData)??

    Oh an its a PIC 12F683
    Microcode studio
    PicBasic Pro 2.50b
    MPASM

  4. #4
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    you have to send it one byte at a time. You can chose if you want to send the high or low byte first. Below is an example of sending the high byte first:

    SerOut WhatEverTheTxPinIs, T2400, [TxData.HighByte, TxData.LowByte]

    ...Nice - I was writing that at the same time as you.

    I've seen code on this forum where they just give it the word and it seems to send it (and receive it at the other PIC too). Or am I just seeing things?
    (I'm actually trying to search my history to show you what I'm talking about, but as you'd expect, i can't find it.)

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by masosi View Post
    But surely I can get it working with just telling it to send the word (TxData)??
    Nope. SEROUT accepts bytes only.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  6. #6
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Good. Done. Thanks.
    I can sleep now!

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