2nd hardware UART


Results 1 to 28 of 28

Threaded View

  1. #8
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: 2nd hardware UART

    Regarding setting the regs directly: this is what I've tried (note this is set to 115200 baud as that was the original objective)

    Code:
    OSCFRQ = %1000 '64Mhz
    
    Define OSC 64
    
    PRECISION  CON 8 SYSTEM  '8 byte = 64 bit precision
    INCLUDE "N-Bit_Math.pbp"
    
    'Use for hardware serial comms to SD card module
    '******************************************************************************
    'Configure UART Control Register 0
    U2CON0.7 = 1 'BRGS = 1 (high speed baud generator)
    U2CON0.6 = 0 'ABDEN = 0 Auto-baud Detect Disabled 
    U2CON0.5 = 1 'TXEN: Transmit Enabled
    U2CON0.4 = 1 'RXEN: Receive Disabled
    U2CON0.3 = 0 '0000 = Asynchronous 8-bit UART mode
    U2CON0.2 = 0 '0000 = Asynchronous 8-bit UART mode
    U2CON0.1 = 0 '0000 = Asynchronous 8-bit UART mode
    U2CON0.0 = 0 '0000 = Asynchronous 8-bit UART mode
    
    U2CON1.7 = 0 'Turn Serial port 2 off for baud setting
     
    U2BRGL = 138  'Baud Divisor low byte
    U2BRGH = 0    'Baud Divisor high byte
    
    U2RXPPS = %1011 'Assign UART RX pin to RB3
    RB0PPS = %010110  'Assign UART2 TX pin to RB0
     
    U2CON1.7 = 1 'Turn Serial port 2 on
    '******************************************************************************
     
    'Configure AN2 as Analog Inputs (PortA2)
    ANSELB = %00000000 'Everything Digital
    
    TRISB.0 = 0 'SD_Card_TX Hardware UART
    TRISB.3 = 1 'SD_Card_RX Hardware UART
    
    hSerout2 ["Test",13,10]
    That doesn't provide any joy either.
    Last edited by rocket_troy; - 13th August 2024 at 16:45.

Similar Threads

  1. PID-filter routine (2nd try).
    By HenrikOlsson in forum Code Examples
    Replies: 131
    Last Post: - 3rd October 2018, 07:53
  2. Setup baudrate on hardware uart on 18F4520
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th August 2010, 00:31
  3. crucial error in a 90% working hardware uart
    By mimmmis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd September 2008, 14:18
  4. Serial Port Complete 2nd Edition
    By Bruce in forum Serial
    Replies: 4
    Last Post: - 8th November 2007, 15:28
  5. 2nd Order Digital Filter for 24-bit
    By sefayil in forum mel PIC BASIC
    Replies: 0
    Last Post: - 2nd December 2005, 21:55

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