Serial Communication Assembly code -PIC EUSART

Discussion in 'Embedded Systems and Microcontrollers' started by 74266, Sep 27, 2016.

  1. 74266

    Thread Starter Member

    Mar 20, 2016
    41
    0
    I just want to ask if does anyone have a program in ASSEMBLY FORMAT(low level) that will instruct the DCE to read or write data from or to the LAT, PORT and TRIS A, B, D, and E registers using EUSART (Serial). The DTE will send 2 bytes of information in the following format:
    1st byte (register) 2nd byte (data)
     
  2. AlbertHall

    Well-Known Member

    Jun 4, 2014
    1,969
    388
    It is very unlikely that you will find any code which does what you want. There are plenty of examples on www of using the PIC EUSART and you will have to adapt the transmit and receive code to send the data you want, and the receive code to apply that data as you require.
    http://ww1.microchip.com/downloads/en/DeviceDoc/usart.pdf
     
  3. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    What is or are DCE and DTE? Which microcontroller? Why do you need to do this?

    Reading a port or register is simple. Use:
    Code (Text):
    1. movf   <name>,w
    Once it is in w, they you can do what you want, like move it to the EUSART. Have you made any attempts to solve this question yourself?

    John
     
  4. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,814
    834
    DTE is Data Terminal Equipment. Originally referred to a standalone dumb terminal device. DCE is Data Communications Equipment. Such as a host computer or modem. The terms are from the 1980s and were widely used in reference to the RS232 standard.
     
  5. jayanthd

    Member

    Jul 4, 2015
    274
    29
    Why assembly language code ? Why not C Code ? I can provide you a C code and Compiler generated assembly code if you desire.
     
    74266 likes this.
  6. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    @djsfantasi
    If that is what the TS meant, then a lot more information is needed , such as the DCE instruction set, since the TS wants that device to query the PIC:
    I suspect those terms may have been used in a different or more abstract context, as the construct of the question is highly suggestive of a homework assignment. We need the TS to clarify what is needed and what he has already done to solve the assignment.

    John
     
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,570
    2,380
    In original modem use, DCE/DTE (Data Carrier Equipment and Data Terminal Equipment) was a 9 conductor cable connection arrangement for hardware handshake of the Tx & RX equipment Known as a Null Modem cable.
    It is rarely used anymore on RS232 equipment, now more common is the S/W handshake code XON/XOFF and a 3 wire cable used.
    Max.
    .
     
    Last edited: Sep 27, 2016
  8. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,570
    2,380
    This is the XON/XOFF method.
    XON\XOFF Handshaking is a software protocol that is used to control data flow.
    Suppose that the computer were sending data to an instrument which could accept no more data for the time being - the instrument would send the single XOFF character to the computer which would stop sending data until it received an XON character to restart transmission. The same arrangements would apply for the reverse direction of data flow.

    XON is ASCII character 17 and XOFF ASCII character 19.
    Should be very easy to implement in Assembly.
    Max.
     
  9. 74266

    Thread Starter Member

    Mar 20, 2016
    41
    0
    Because we are still only using assembly language also we are using PIC18f4550
     
  10. 74266

    Thread Starter Member

    Mar 20, 2016
    41
    0
Loading...