9-Bit Send/Receive


Results 1 to 3 of 3

Threaded View

  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 16:42.

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, 12:51
  2. how to send and receive sms using vb?
    By shyhigh2002 in forum Off Topic
    Replies: 0
    Last Post: - 1st April 2009, 09: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, 13:37
  4. send and receive data using pic 16f84a
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2006, 20:12
  5. send and receive data using pic 16f84a
    By PoTeToJB in forum Serial
    Replies: 1
    Last Post: - 25th February 2006, 14:47

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