1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

How To Add Nicely Aligned Code

Discussion in 'Site Issues & Feedback' started by Gayan Soyza, May 15, 2018.

  1. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,826
    Likes:
    19
    Location:
    Colombo
    Evertime when I add my assembly code it will uploading with messed up.How do you upload nicely aligned code?

    Code (text):

    Do_UP            movlw        .10
                movwf        Hold_Time
                incf        Character,F
                movf        Character,W
                xorlw        .94
                btfss        STATUS,Z
                goto        Do_UP_Select
                clrf        Character
    Do_UP_Select        movf        Character,W
                call        Load_Char
                call        Adjust_FSR
                ;
    Do_Check_Up_Rel        btfsc        PORTB,4
                goto        Text_Key_Check      
                btfss        Flag_Register,End_Frame
                goto        $-1
                bcf        Flag_Register,End_Frame
                decfsz        Hold_Time,F
                goto        Do_Check_Up_Rel
                goto        Do_UP
     
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,655
    Likes:
    409
    Location:
    Brisbane Australia
    ONLINE
    I copy the code into notepad++ before posting here,
    Code (text):

    Do_UP           movlw   .10
                    movwf   Hold_Time
                    incf    Character,F
                    movf    Character,W
                    xorlw   .94
                    btfss   STATUS,Z
                    goto    Do_UP_Select
                    clrf    Character
    Do_UP_Select    movf    Character,W
                    call    Load_Char
                    call    Adjust_FSR
                    ;
    Do_Check_Up_Rel btfsc   PORTB,4
                    goto    Text_Key_Check      
                    btfss   Flag_Register,End_Frame
                    goto    $-1
                    bcf     Flag_Register,End_Frame
                    decfsz  Hold_Time,F
                    goto    Do_Check_Up_Rel
                    goto    Do_UP
     
    I think it's set to convert tabs to spaces which is why it works.

    But, every now and then it still messes up.

    Mike.
    Can one of the site technical guys tell me what font the code box uses? Maybe setting Notepad++ to the same font will fix it.
     
  3. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,810
    Likes:
    567
    Location:
    Vermont (GMT-5:00)
    I believe it's Consolas.
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,826
    Likes:
    19
    Location:
    Colombo
    Hi Mike,

    I downloaded and installed notepad++. I did your method & it worked nicely.

    Thanks.

    Code (text):

    ;-------------------------------------------------------------          
    Sec_Adj_Mode    bcf        PORTA,7           ; CS/ = 0
                    movlw      .8                ; digit H10 blank
                    call       SPI_Out
                    movlw      b'00001111'
                    call       SPI_Out
                    bsf        PORTA,7           ; CS/ = 1
                    bcf        PORTA,7           ; CS/ = 0
                    movlw      .7                ; digit H1 blank
                    call       SPI_Out
                    movlw      b'00001111'
                    call       SPI_Out
                    bsf        PORTA,7          
                    bcf        PORTA,7           ; CS/ = 0
                    movlw      .6                ; digit M10 blank
                    call       SPI_Out
                    movlw      b'00001111'
                    call       SPI_Out
                    bsf        PORTA,7           ; CS/ = 1
                    bcf        PORTA,7           ; CS/ = 0
                    movlw      .5                ; digit M1 blank
                    call       SPI_Out
                    movlw      b'00001111'
                    call       SPI_Out
                    bsf        PORTA,7           ; CS/ = 1
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice