Setup baudrate on hardware uart on 18F4520


Closed Thread
Results 1 to 2 of 2
  1. #1
    Pedro Pinto's Avatar
    Pedro Pinto Guest

    Default Setup baudrate on hardware uart on 18F4520

    Hello

    With this code i init the uart, suposed with the baudrate 2400, but on the Microcode communication Tool it works correctly only if i select 9600.
    Anyone know what is the problem?
    Thanks for explanation
    Best regards
    Pedro

    DEFINE OSC 16
    INCLUDE "modedefs.bas"
    INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts

    ASM
    INT_LIST macro
    INT_Handler RX_INT, _IntRx, PBP, yes
    endm
    INT_CREATE
    ENDASM
    @ INT_ENABLE RX_INT

    ' Initialize USART
    TRISC = %10111111 ' Set TX (PortC.6) to out, rest in
    SPBRG = 25 ' Set baud rate to 2400
    RCSTA = %10010000 ' Enable serial port and continuous receive
    TXSTA = %00100000 ' Enable transmit and asynchronous mode

  2. #2
    Pedro Pinto's Avatar
    Pedro Pinto Guest


    Did you find this post helpful? Yes | No

    Default

    Hello again

    Problem is solved reading a old post and thanks PicMultiCalc program

    Best regards
    Pedro

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