Some ASM Help Please


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Some ASM Help Please

    You must dig little dipper in PBP librarys. Look for PBPPICxx.mac and PBPPICxx.LIB files for macro definition.
    If I was in your place, I would start from controlling PIN, then LCD basic communication, to display char, then to math involved in digit extraction...
    EDIT:
    PBP libs are great resource for learning ASM.... Lot of work and testing are organized and described in one place....
    I learned ASM from PBP lib, and PIC datasheet. Now all interrupts my are written in ASM.
    Last edited by pedja089; - 13th May 2018 at 18:43.

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Some ASM Help Please

    Thanks, predja089. Spent the day fighting with it, but I have something that works. I tried typing it into PBP3 & looking at the ASM, but that didn't get me there. Now I'm able to take an ADC-12 read (0 >> 4095) and convert it into 4 decimal digits:

    Code:
    	MOVF	ADRESH,W
    	MOVWF	b0
    	MOVF	ADRESL,W
    	MOVF	b1
    	CALL	DoMath
    	MOVLW	0x30
    	ADDWF	Dig1,W
    	MOVWF	Volts11
    	MOVLW	0x30
    	ADDWF	Dig2,W
    	MOVWF	Volts12
    	MOVLW	0x30
    	ADDWF	Dig3,W
    	MOVWF	Volts13
    	MOVLW	0x30
    	ADDWF	Dig4,W
    	MOVWF	Volts14
    	CALL	Display
    	RETURN
    
    DoMath:
        BANKSEL Dig1
        CLRF    Dig1
        CLRF    Dig2
        CLRF    Dig3
        CLRF    Dig4
        BCF	    STATUS, C
        BCF	    STATUS, DC
    Math2:			    ;Find the 1000,s Digit
        MOVLW   0x03
        SUBWF   b1, W
        BTFSS   STATUS,C
        BRA	    Math3
        MOVLW   0xE8
        SUBWF   b0, W
        BTFSS   STATUS,C
        BRA	    Math2a
        MOVLW   0x03
        SUBWF   b1, F
        MOVLW   0xE8
        SUBWF   b0, F
        INCF    Dig1
        BRA	    Math2
    Math2a:
        MOVLW   0x04
        SUBWF   b1,W
        BTFSS   STATUS,C
        GOTO    Math3
        MOVLW   0x04
        SUBWF   b1,F
        MOVLW   0x18
        ADDWF   b0
        INCF    Dig1
        BRA	    Math2
    Math3:			    ;Find the 100,s Digit
        MOVLW   0x64
        SUBWF   b0, W
        BTFSS   STATUS,C
        BRA	    Math4
        MOVLW   0x64
        SUBWF   b0, F
        INCF    Dig2
        BRA	    Math3
    Math4:			    ;Account for V1H Carry/Borrow
        DECF    b1, W
        BTFSS   STATUS,Z
        GOTO    Math5
        DECF    b1,F
        MOVLW   0x9C
        ADDWF   b0
        INCF    Dig2
        BRA	    Math3
    Math5:			    ;Find the 10,s Digit
        MOVLW   0x0A
        SUBWF   b0, W
        BTFSS   STATUS,C
        BRA	    Math6
        MOVLW   0x0A
        SUBWF   b0, F
        INCF    Dig3
        BRA	    Math5
    Math6:
        MOVF    b0,W
        MOVWF   Dig4
     RETURN

Similar Threads

  1. ASM help
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 21st October 2009, 03:08
  2. ASM or PBP First?
    By mackrackit in forum Off Topic
    Replies: 4
    Last Post: - 10th October 2009, 12:08
  3. ASM Help
    By fbraun in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th October 2007, 16:05
  4. How to do this in ASM?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 19th November 2005, 07:38
  5. asm to picbasic
    By wilfried in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th March 2003, 01:18

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