Continue to Site

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.

  • 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.

How To Add Nicely Aligned Code

Status
Not open for further replies.

Gayan Soyza

Active Member
Evertime when I add my assembly code it will uploading with messed up.How do you upload nicely aligned code?

Code:
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 copy the code into notepad++ before posting here,
Code:
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.
 
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.
I believe it's Consolas.
 
Hi Mike,

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

Thanks.

Code:
;-------------------------------------------------------------           
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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top