9-Bit Send/Receive


+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2013
    Posts
    17

    Default 9-Bit Send/Receive

    Hello everyone,

    In brief, I would like to send/receive 9600,8,O,1. (RS485) by using 16F876A like this format:

    Address, command1, command2, command3 ,checksum.

    I start my work first for sending and now I am still involved at sending-section. I use these below settings:

    And the problem is:
    It always sends the first byte correctly, after that, the second and third is not the case which I respect. Depends on case 7th bit is one “1” and changes commands and checksum. seems they sum by 80 Hex.

    Any suggestion, please? Or a sample routine which has been already tested for 9600,8,O,1.

    ManyThanks in advance.


    Code:
    ; With 4Mhz Osc
    DEFINE HSER_BAUD 9600
    DEFINE HSER_BITS 9   
    DEFINE HSER_ODD 1        'Set ODD Parity
    DEFINE HSER_SPBRG 25 
    DEFINE HSER_CLROERR 1
    TRISB=$FF
    TRISC=0
    Address VAR BYTE
    Command1 VAR BYTE
    Command2 VAR BYTE
    Command3 VAR BYTE
    Checksum VAR BYTE
    Address = $40
    Command1 = $50
    Command2 = $44 
    Command3 = $A5
    Checksum =  Address ^  Command1 ^ Command2 ^ Command3
    while (PORTB.0 = 1)
    HSEROUT [ Address ]
    pause 1
    HSEROUT [ Command1 ]
    pause 1
    HSEROUT [ Command2 ]
    pause 1
    HSEROUT [ Command3 ]
    pause 1
    HSEROUT [ Checksum ]
    PAUSE 1
    WEND
    Last edited by andymuller; - 24th January 2016 at 17:42.

  2. #2
    Join Date
    Jan 2010
    Posts
    37

    Default Re: 9-Bit Send/Receive

    I found something like this here:
    The second characteristic is parity. The parity characteristic can be even, odd, mark, space, or none. If even parity, then the last data bit transmitted will be a logical 1 if the data transmitted had an even amount of 0 bits. If odd parity, then the last data bit transmitted will be a logical 1 if the data transmitted had an odd amount of 0 bits. If MARK parity, then the last transmitted data bit will always be a logical 1. If SPACE parity, then the last transmitted data bit will always be a logical 0. If no parity then there is no parity bit transmitted.
    Hope is useful. Odd parity is probably the problem.

  3. #3
    Join Date
    Jun 2013
    Posts
    17

    Default Re: 9-Bit Send/Receive

    Hello,

    My source code which I have already written it here, is all right.

    Without any doubt, I should express my gratitude to Darrel Taylor, Mister_e and, Henrik Olsson, . . . and many other expert guys who participate here and help people.

    I have read their already-published posts and I found the clues.

    My Fault was somewhere else in target device. I didn't read the target catalogue well.

    I apologize.


    Kind regards,
    Good Luck.


    Andy

Similar Threads

  1. Code for Send/Receive TTL/Comport Sample?
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 52
    Last Post: - 3rd July 2013, 13:51
  2. how to send and receive sms using vb?
    By shyhigh2002 in forum Off Topic
    Replies: 0
    Last Post: - 1st April 2009, 10:18
  3. How to build modem for only send and receive the msg
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th April 2006, 14:37
  4. send and receive data using pic 16f84a
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2006, 21:12
  5. send and receive data using pic 16f84a
    By PoTeToJB in forum Serial
    Replies: 1
    Last Post: - 25th February 2006, 15:47

Posting Permissions

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