Menu

BAUDCOM Bits, how do I control ?

Help
Paul Haug
2017-06-11
2017-06-11
  • Paul Haug

    Paul Haug - 2017-06-11

    I am trying to mess with two bits in the BAUDCON register on a 18F26K20 chip.
    According to the data sheet these are called CKTXP (bit 4, Xmit polarity bit) and the DTRXP (bit 5, Recv polarity bit).
    When I asm it states error, “ configuration settings not valid: DTRXP = ON”
    I am using Ver 0.97.01 asm
    .
    Here is my config cmds, “BODEN = OFF” works, no eror.
    .
    #chip 18F26K20, 16, 8

        #option explicit
    
        #config CKTXP = ON
        #config DTRXP = ON
        #config BODEN = OFF
        #define USART_BAUD_RATE 9600
        #define USART_BLOCKING
        #define USART_TX_BLOCKING
    

    So, is it possible to diddle with these bits to experiment with my chip's UART ?
    .
    I am using the AXE27 , but requires inversion of the data to work with PuTTY or Terminal.
    Currently I am using a single transistor to invert the output to the USB converter

     

    Last edit: Paul Haug 2017-06-11
  • William Roth

    William Roth - 2017-06-11

    Only use #Config for setting the config bits. CKTXP and DTRXP are not config bits so set them in source code using set.

        #chip 18F26K20, 16
        #option explicit
    
        #config BOREN = OFF
        #define USART_BAUD_RATE 9600
        #define USART_BLOCKING
        #define USART_TX_BLOCKING
    
        Set CKTXP ON
        Set DTRXP ON
    

    BTW, The proper spellng is BOREN instead of BODEN.

     

    Last edit: William Roth 2017-06-11
  • Paul Haug

    Paul Haug - 2017-06-12

    Thanks, I will try that.
    .
    EDIT: It works !! Perfect, now I don't need the kluge to invert the data.
    Also will allow me to mess with other control registers later as I try to learn more on how to mess this up !!
    As for BODEN, I thought that was Brown Out Detection Off. What does BOREN stand for ???
    Paul

     

    Last edit: Paul Haug 2017-06-12
  • William Roth

    William Roth - 2017-06-12

    The best sources for information on config bit names are the datasheet and the chipdata file for the chip in question, Configuration bit names can vary from chip to chip, even for the same function,

    Open 18F26K20.dat from the chipdata folder. Look at the [config] section near the end of the file. This will show you proper names for config options for that specific chip. The datasheet will tell you its function,

     
  • Paul Haug

    Paul Haug - 2017-06-12

    Thanks William, I do use the data sheets provided by Microchip and find the register descriptions very helpful. Many thanks to you for pointing out to use the "Set" to diddle the individual bits in a register.
    Guess it is a holdover from my days as an assy programmer to want to get down to the bit level.

     

    Last edit: Paul Haug 2017-06-12

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.