Menu

Display Registers on a Terminal

2018-11-19
2018-11-20
  • William Roth

    William Roth - 2018-11-19

    When debugging code, many times I want to see the contents of a register in binary format. I want to see which bits are a "1" and which are a "0"

    This code shows one way of doing that using Hserial and a terminal.

    There are 3 sub routines. Add these to your Great Cow Basic Source Code

    HserprintReg
    Space
    Dash

    Syntax: 
    HserprintReg (String, RegisterName)
    

    Example:

    HserPrintReg("OSCCON1   ", OSCCON1)
    

    Terminal will display:

     ------------------------------------------------------------
     OSCCON1      Bit7  Bit6  Bit5  Bit4  Bit3  Bit2  Bit1  Bit0
    
                    0     1     1     0     0     0     0     0     
    ------------------------------------------------------------
    
     

    Last edit: William Roth 2018-11-19
  • Chris Roper

    Chris Roper - 2018-11-19

    Nice, Thanks.

    I have beeen doing somthing similar but printing with Hex(regname) becouse I was to lazy to create a Bin() function.

    With a VT100 terminal emulator, a few Locate statements and this code you have one of the best debuggers you will ever need.

     

    Last edit: Chris Roper 2018-11-19
  • William Roth

    William Roth - 2018-11-20

    It's been a while since I used TeraTerm but I know that a macro can be created to do most of the heavy lifting , like lines, boxes, etc . Then all the microcontroller needs to do is send the data to the correct location on the terminal screen using VT esc and csi sequences,

     
  • Chris Roper

    Chris Roper - 2018-11-20

    I have been using the ESC seqances but was not aware of the macro capabilitys.
    I will look into that,
    Thanks Bill.

     

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.