Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 27th December 2006, 09:02 AM   (permalink)
Default

Quote:
Originally Posted by Ayne
I think we can use direct IF command in MPLAB.. What u say?
I am saying Yes because In the MPLAB assembler help file there are examples that using IF command in assembly.
Try reading the helpfile properly - the IF is an assembler directive, it doesn't generate any code.

Quote:

AN617(Fixed Point Routines) is a file from Microchip. They are useing MOVPF instruction.
It's probably a macro?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 27th December 2006, 09:51 AM   (permalink)
Default

Quote:
;************************************************* *********************************************
;
; 16x16 Bit Unsigned Fixed Point Multiply 16 x 16 -> 32
;
; Input: 16 bit unsigned fixed point multiplicand in AARGB0, AARGB1
; 16 bit unsigned fixed point multiplier in BARGB0, BARGB1
;
; Use: CALL FXM1616U
;
; Output: 32 bit unsigned fixed point product in AARGB0, AARGB1,
; AARGB2, AARGB3
;
; Result: AARG <-- AARG * BARG
;
; Max Timing: 26 clks
;
; Min Timing: 26 clks
;
; PM: 25 DM: 7
;
;
FXM1616U MOVPF AARGB1,TEMPB1
MOVFP AARGB1,WREG
MULWF BARGB1
MOVPF PRODH,AARGB2
MOVPF PRODL,AARGB3
MOVFP AARGB0,WREG
MULWF BARGB0
MOVPF PRODH,AARGB0
MOVPF PRODL,AARGB1
MULWF BARGB1
MOVPF PRODL,WREG
ADDWF AARGB2,F
MOVPF PRODH,WREG
ADDWFC AARGB1,F
CLRF WREG,F
ADDWFC AARGB0,F
MOVFP TEMPB1,WREG
MULWF BARGB0
MOVPF PRODL,WREG
ADDWF AARGB2,F
MOVPF PRODH,WREG
ADDWFC AARGB1,F
CLRF WREG,F
ADDWFC AARGB0,F
RETLW 0x00
;*************************************************
This is the code
Ayne is offline   Reply With Quote
Old 27th December 2006, 10:52 AM   (permalink)
Default

Quote:
Originally Posted by Ayne
This is the code
You might try reading the rest of that code?, where it says it's for the 17C series - and is in appendix F!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 27th December 2006, 03:09 PM   (permalink)
Default

Quote:
GOTO $ + 4 ; It will jump backward(4 Steps) from it's current location
GOTO $ - 4 ; It will jump forward (4 Steps) from it's current location
In above code i am right or not???

Second
PIC16F877A
i want to multiply, 16x16 Bit Unsigned Fixed Point Multiply 16 x 16 -> 32. Is there any library or any subrutine for this??? Or any thing that can help instead of writing enough large code???
Ayne is offline   Reply With Quote
Old 27th December 2006, 03:43 PM   (permalink)
Default

Quote:
Originally Posted by Ayne
In above code i am right or not???
No you're not right, + jumps forward, and - jumps back.

Quote:

Second
PIC16F877A
i want to multiply, 16x16 Bit Unsigned Fixed Point Multiply 16 x 16 -> 32. Is there any library or any subrutine for this??? Or any thing that can help instead of writing enough large code???
Check on the PICLIST, there are plenty of maths routines - however, do you REALLY need to use 16 x 16? - often a little thought can greatly simplify what you need to do.

You might also check EPE, they have 32 bit maths routines.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 27th December 2006, 03:57 PM   (permalink)
Default

tHANKS.
wHAT IS EPE???? ANY WEB
Ayne is offline   Reply With Quote
Old 27th December 2006, 03:59 PM   (permalink)
Default

Quote:
Originally Posted by Ayne
tHANKS.
wHAT IS EPE???? ANY WEB
It's a magazine - have you never heard of 'google', or other search engines?.

It's the first two hits on google!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 28th December 2006, 06:19 AM   (permalink)
Default

Quote:
Found label after column 1. (RLF)
error during build.
help needed.

In my view, RLF is an older command. cuz when i write in MPLAB it color does't change in blue.
Ayne is offline   Reply With Quote
Old 28th December 2006, 06:55 AM   (permalink)
Default

You need to supply more information. Try posting all your code and explaining exactly what you are trying to do. Posting random questions is just wasting everone's time.

Mike.
P.S. this is starting to remind me of Walter.
Pommie is online now   Reply With Quote
Old 28th December 2006, 07:09 AM   (permalink)
Default

Quote:
btfsc INTCON,T0IF
goto INT_TMR0


movfw SEGMENT; move segment to working register
sublw .32; subtract decimal (.) 32
movlw .2; put 2 into work register
btfss STATUS,C; test is w was more than 32
movwf SEGMENT; if it was store W in segment
Plz explain this, u write it in ur previous pose on page 1 of this thread.
how a carry will be gernate
Ayne is offline   Reply With Quote
Old 28th December 2006, 08:09 AM   (permalink)
Default

OOOPS SOORY, NOW I have understand how this will work.
Ayne is offline   Reply With Quote
Old 28th December 2006, 08:10 AM   (permalink)
Default

Please study the data sheet and the above code until you understand how it works.

Mike.
Pommie is online now   Reply With Quote
Old 28th December 2006, 09:33 AM   (permalink)
Thumbs up Both picture and code are not completed

Code:
;***************************************************************************************************
		LIST	p=16F877A, W=2, X=ON, R=DEC	;tell assembler what chip we are using
		include "P16F876.inc"			;include the defaults for the chip
		ERRORLEVEL	0,	-302		;suppress bank selection messages

		__CONFIG    0x393A			;sets the configuration settings (oscillator type etc.)

;***************************************************************************************************


;**************************************************************************************************;
;					VARIABL DECLAIRATION														   ;
;**************************************************************************************************;
	CBLOCK	0X20		;START of general purpose registers

		W_TEMP
		S_TEMP
		P_TEMP

		DIGIT:5
		SEGMENT
		I

		ACC0
		ACC1
		ACC2
		ACC3
		TEMP0
		TEMP1
		TEMP2
		TEMP3

		AD3M
		AD3L
		LOOPER
		D2
		D1
		R2
		R1
		

		TEMP_VOLT_L
		TEMP_VOLT_H

	ENDC

;**************************************************************************************************;
;					INTERRUPT	ARE		STARTING		FROM		HERE						   ;
;**************************************************************************************************;

		; Intrupt Vector
		ORG	0x0004

INT
		MOVWF		W_TEMP		; Save W Register
		SWAPF		STATUS,W	; Swap Status to be saved in W
		MOVWF		S_TEMP		; Save Status Register
		MOVF		PCLATH		
		MOVWF		P_TEMP		;Save PCLATH


		BTFSS		INTCON,T0IF	;Flag Set if TMR0 Interrupt
		GOTO		$ + 2		;Jump if not timed out
		GOTO		INT_TMRO


		BTFSS		PIR1,TMR1IF ;Flag Set if TMR1 Interrupt (This timer is in counter mode)
		GOTO		$ + 2		;Jump if not timed out
		GOTO		INT_TMR1


		BTFSS		PIR1,TMR2IF ;Flag Set if TMR2 Interrupt
		GOTO		INTX		;Jump if not timed out			
		GOTO		INT_TMR2

		GOTO		INTX		;Jump if not timed out

;***********************************************************;
;						TMR0 INTERRUPT						;
;***********************************************************;
INT_TMRO
		BCF			INTCON,TOIF ;Clear the calling flag

		GOTO		INTX		;Jump out from Interrupt

;***********************************************************;
;						TMR1 INTERRUPT						;
;***********************************************************;
INT_TMR1
		BCF			PIR1,TMR1IF ; ;Clear the calling flag

		GOTO		INTX		;Jump out from Interrupt

;***********************************************************;
;						TMR2 INTERRUPT						;
;***********************************************************;
INT_TMR2
		BCF			PIR1,TMR2IF ; ;Clear the calling flag

		MOVF		SEGMENT		;Save data from SEGMENT
		MOVWF		PORTC		;And send it to PORTC
		MOVF		DIGIT+I		;Save data from DIGIT
		MOVWF		PORTB		;And send it to PORTB

		INCF		I, F
		MOVF		I
		SUBLW		.4
		MOVLW		.0
		BTFSS		STATUS, C		
		MOVWF		I	
	
		
		RLF			SEGMENT, F	;Shift left 
		MOVF		SEGMENT
		SUBLW		.32
		MOVLW		.2
		BTFSS		STATUS, C
		MOVWF		SEGMENT
		

		;HERE SOME CODE IS MISSIN xxxxxxxxxxxxxx
	
		GOTO		INTX		;Jump out from Interrupt

;***********************************************************;
;				EXITING FROM INTERRUPT						;
;***********************************************************;
INTX
		MOVF		P_TEMP
		MOVWF		PCLATH		;Restore PCLATH
		SWAPF		S_TEMP, W	
		MOVWF		STATUS		;Resotre STATUS register
		SWAPF		W_TEMP, F
		SWAPF		W_TEMP, W	;Restore W register

		REtFIE					; RETurn From IntErrupt

;**************************************************************************************************
;					VARIABLE MULTIPLY BY 40000
ROUTINE_40000
;**************************************************************************************************
; ACC = ACC * 40000
; Temp = TEMP
; ACC size = 16 bits
; Error = 0.2 %
; Bytes order = little endian
; Round = no

; ALGORITHM:
; Clear accumulator
; Add input * 32768 to accumulator
; Add input * 8192 to accumulator
; Substract input * 1024 from accumulator
; Move accumulator to result
;
; Approximated constant: 39936, Error: 0.16 %

;     Input: ACC0 .. ACC1, 16 bits
;    Output: ACC0 .. ACC3, 32 bits
; Code size: 84 instructions


;shift accumulator left 10 times
	clrc
	rlf	ACC0, f
	rlf	ACC1, f
	clrf	ACC2
	rlf	ACC2, f
	rlf	ACC0, f
	rlf	ACC1, f
	rlf	ACC2, f
	movf	ACC2, w
	movwf	ACC3
	movf	ACC1, w
	movwf	ACC2
	movf	ACC0, w
	movwf	ACC1
	clrf	ACC0

;copy accumulator to temporary
	movf	ACC3, w
	movwf	TEMP3
	movf	ACC2, w
	movwf	TEMP2
	movf	ACC1, w
	movwf	TEMP1
	movf	ACC0, w
	movwf	TEMP0


;negate accumulator
	comf	ACC0, f
	comf	ACC1, f
	comf	ACC2, f
	comf	ACC3, f
	incf	ACC0, f
	skpnz
	incf	ACC1, f
	skpnz
	incf	ACC2, f
	skpnz
	incf	ACC3, f

;shift temporary left 3 times
	clrc
	rlf	TEMP0, f
	rlf	TEMP1, f
	rlf	TEMP2, f
	rlf	TEMP3, f
	rlf	TEMP0, f
	rlf	TEMP1, f
	rlf	TEMP2, f
	rlf	TEMP3, f
	rlf	TEMP0, f
	rlf	TEMP1, f
	rlf	TEMP2, f
	rlf	TEMP3, f

;add temporary to accumulator
	movf	TEMP0, w
	addwf	ACC0, f
	movf	TEMP1, w
	skpnc
	incfsz	TEMP1, w
	addwf	ACC1, f
	movf	TEMP2, w
	skpnc
	incfsz	TEMP2, w
	addwf	ACC2, f
	movf	TEMP3, w
	skpnc
	incfsz	TEMP3, w
	addwf	ACC3, f

;shift temporary left 2 times
	clrc
	rlf	TEMP0, f
	rlf	TEMP1, f
	rlf	TEMP2, f
	rlf	TEMP3, f
	rlf	TEMP0, f
	rlf	TEMP1, f
	rlf	TEMP2, f
	rlf	TEMP3, f

;add temporary to accumulator
	movf	TEMP0, w
	addwf	ACC0, f
	movf	TEMP1, w
	skpnc
	incfsz	TEMP1, w
	addwf	ACC1, f
	movf	TEMP2, w
	skpnc
	incfsz	TEMP2, w
	addwf	ACC2, f
	movf	TEMP3, w
	skpnc
	incfsz	TEMP3, w
	addwf	ACC3, f
	RETURN
;***************************************************************************************************




;***************************************************************************************************
;									VARIABLE DIVIDED BY 1023
ROUTINE_1023
;***************************************************************************************************
; ACC = ACC * 0.0009775
; Temp = TEMP
; ACC size = 32 bits
; Error = 0.5 %
; Bytes order = little endian
; Round = no

; ALGORITHM:
; Clear accumulator
; Add input / 1024 to accumulator
; Move accumulator to result
;
; Approximated constant: 0.000976563, Error: 0.0959079 %

;     Input: ACC0 .. ACC3, 32 bits
;    Output: ACC0 .. ACC2, 23 bits
; Code size: 14 instructions

;shift accumulator right 10 times
	movf	ACC1, w
	movwf	ACC0
	movf	ACC2, w
	movwf	ACC1
	movf	ACC3, w
	movwf	ACC2
	clrc
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f
	clrc
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f
	RETURN
;***************************************************************************************************


;***************************************************************************************************
;			Takes hex number in NumH:NumL  Returns decimal in ;TenK:Thou:Hund:Tens:Ones
ROUTINE_DEC
;***************************************************************************************************

;input
;=A3*163 + A2*162 + A1*161 + A0*160
;=A3*4096 + A2*256 + A1*16 + A0
NumH            EQU AD3M        ;A3*16+A2
NumL            EQU AD3L	;A1*16+A0
;share variables
;=B4*104 + B3*103 + B2*102 + B1*101 + B0*100
;=B4*10000 + B3*1000 + B2*100 + B1*10 + B0
TenK            EQU LOOPER      ;B4
Thou            EQU D2		;B3
Hund            EQU D1		;B2
Tens            EQU R2		;B1
Ones            EQU R1		;B0

	swapf	NumH,w	;w  = A2*16+A3
        andlw   0x0F     ;w  = A3		*** PERSONALLY, I'D REPLACE THESE 2
        addlw   0xF0	;w  = A3-16	*** LINES WITH "IORLW b'11110000B' " -AW
        movwf   Thou	;B3 = A3-16
        addwf   Thou,f	;B3 = 2*(A3-16) = 2A3 - 32
        addlw   .226	;w  = A3-16 - 30 = A3-46
        movwf   Hund	;B2 = A3-46
        addlw   .50	;w  = A3-46 + 50 = A3+4
        movwf   Ones	;B0 = A3+4

        movf    NumH,w	;w  = A3*16+A2
        andlw   0x0F	;w  = A2
        addwf   Hund,f	;B2 = A3-46 + A2 = A3+A2-46
        addwf   Hund,f	;B2 = A3+A2-46  + A2 = A3+2A2-46
        addwf   Ones,f	;B0 = A3+4 + A2 = A3+A2+4
        addlw   .233	;w  = A2 - 23
        movwf   Tens	;B1 = A2-23
        addwf   Tens,f	;B1 = 2*(A2-23)
        addwf   Tens,f	;B1 = 3*(A2-23) = 3A2-69 (Doh! thanks NG)

        swapf   NumL,w	;w  = A0*16+A1
        andlw   0x0F	;w  = A1
        addwf   Tens,f	;B1 = 3A2-69 + A1 = 3A2+A1-69 range -69...-9
        addwf   Ones,f	;B0 = A3+A2+4 + A1 = A3+A2+A1+4 and Carry = 0 (thanks NG)

        rlf     Tens,f	;B1 = 2*(3A2+A1-69) + C = 6A2+2A1-138 and Carry is now 1 as tens register had to be negitive
        rlf     Ones,f	;B0 = 2*(A3+A2+A1+4) + C = 2A3+2A2+2A1+9 (+9 not +8 due to the carry from prev line, Thanks NG)
        comf    Ones,f	;B0 = ~(2A3+2A2+2A1+9) = -2A3-2A2-2A1-10 (ones complement plus 1 is twos complement. Thanks SD)
;;Nikolai Golovchenko [golovchenko at MAIL.RU] says: comf can be regarded like:
;;      comf Ones, f
;;      incf Ones, f
;;      decf Ones, f
;;First two instructions make up negation. So,
;;Ones  = -1 * Ones - 1 
;;      = - 2 * (A3 + A2 + A1) - 9 - 1 
;;      = - 2 * (A3 + A2 + A1) - 10
        rlf     Ones,f	;B0 = 2*(-2A3-2A2-2A1-10) = -4A3-4A2-4A1-20

        movf    NumL,w	;w  = A1*16+A0
        andlw   0x0F	;w  = A0
        addwf   Ones,f	;B0 = -4A3-4A2-4A1-20 + A0 = A0-4(A3+A2+A1)-20 range -215...-5 Carry=0
        rlf     Thou,f	;B3 = 2*(2A3 - 32) = 4A3 - 64

        movlw   0x07	;w  = 7
        movwf   TenK	;B4 = 7

;B0 = A0-4(A3+A2+A1)-20	;-5...-200
;B1 = 6A2+2A1-138	;-18...-138
;B2 = A3+2A2-46		;-1...-46
;B3 = 4A3-64		;-4...-64
;B4 = 7			;7
; At this point, the original number is
; equal to TenK*10000+Thou*1000+Hund*100+Tens*10+Ones 
; if those entities are regarded as two's compliment 
; binary.  To be precise, all of them are negative 
; except TenK.  Now the number needs to be normal- 
; ized, but this can all be done with simple byte 
; arithmetic.

        movlw   .10	;w  = 10
Lb1:			;do
        addwf   Ones,f	; B0 += 10
        decf    Tens,f	; B1 -= 1
        btfss   3,0
	;skip no carry
         goto   Lb1	; while B0 < 0
	;jmp carry
Lb2:			;do
        addwf   Tens,f	; B1 += 10
        decf    Hund,f	; B2 -= 1
        btfss   3,0
         goto   Lb2	; while B1 < 0
Lb3:			;do
        addwf   Hund,f	; B2 += 10
        decf    Thou,f	; B3 -= 1
        btfss   3,0
         goto   Lb3	; while B2 < 0
Lb4:			;do
        addwf   Thou,f	; B3 += 10
        decf    TenK,f	; B4 -= 1
        btfss   3,0
         goto   Lb4	; while B3 < 0

        retlw   0
;**************************************************************************************************





		; Table For 7-Segment Common Cathod
NUM
		ADDWF		PCL, F
		RETLW		0x3F		;0
		RETLW		0x06		;1
		RETLW		0x5B		;2
		RETLW		0x4F		;3
		RETLW		0x66		;4
		RETLW		0x6D		;5
		RETLW		0x7D		;6
		RETLW		0x07		;7
		RETLW		0x7F		;8
		RETLW		0x6F		;9

		; For Decimal Points
		RETLW		0xBF		;0.
		RETLW		0x86		;1.
		RETLW		0xDB		;2.
		RETLW		0xCF		;3.
		RETLW		0xE6		;4.
		RETLW		0xED		;5.
		RETLW		0xFD		;6.
		RETLW		0x87		;7.
		RETLW		0xFF		;8.
		RETLW		0xEF		;9.

;**************************************************************************************************;
;					Initialization																   ;
;**************************************************************************************************;

;*****************;
; SetTING TIMMER 0;
;*****************;
Initi_INT_TMR0
		BANKSEL		INTCON
		BSF			INTCON,PEIE		;Enable all peripheral interupts
		BSF			INTCON,GIE		;Global interupt Enable


;*****************;
; SetTING TIMMER 2;
;*****************;
Initi_INT_TMR2
		BANKSEL		T2CON
		MOVLW		B'00111110'
		MOVWF		T2CON

		BANKSEL		PR2
		MOVLW		.249
		MOVWF		PR2

		BSF			PIE1, TMR2IE





Initi_ADC
;***************;
; Set ADCON1	;
;***************;
		BANKSEL		ADCON1
		MOVLW		B'10000101'		;RA0, RA1 AS analog pins.	RA3 +Vref.	Right justified.
		MOVWF		ADCON1
		BANKSEL		ADCON0

;**************************************************************************************************;
;					MAIN	PROGRAM		STARTING		FROM		HERE						   ;
;**************************************************************************************************;
Main
		MOVLW		.0
		MOVWF		DIGIT 
		MOVWF		DIGIT+1
		MOVWF		DIGIT+2
		MOVWF		DIGIT+3
		MOVWF		DIGIT+4
		MOVWF		I
		MOVLW		.2
		MOVWF		SEGMENT

;**************************************************************************************************;
;					VOLTMETER	IS		STARTING		FROM		HERE						   ;
;**************************************************************************************************;
VOLTAGE
	
;***************;
; FOR CHANNEL 0	;
;***************;
		MOVLW		B'10000001'		;FOSC/32, Channel 0, AD ON
		MOVWF		ADCON0

		BSF		ADCON0, GO_DONE		;Initiate conversion
		BTFSC	ADCON0,	GO_DONE		;Test that the conversion is complete?
		GOTO	$-1					; Wait for ADC to finsh

		BANKSEL	ADRESL				;Select bank

		MOVF		ADRESL
		SUBLW		.3				;If there are some voltage then store them
		BTFSS		STATUS, C		
		GOTO		$ + 2
		GOTO		$ + 6			;if there are no voltages then goto channel 1 for checking

		MOVF		ADRESL				
	 	MOVWF		TEMP_VOLT_L		;Store the low byte result into TEMP_VOLT_L register
		
		BANKSEL		ADRESH			;Select bank
		MOVF		ADRESH
		MOVWF		TEMP_VOLT_H		;Store the high byte result into TEMP_VOLT_H register
		GOTO		$ + 17			;and goto voltage calculation

;***************;
; FOR CHANNEL 1	;
;***************;
		MOVLW		B'10001001'		;FOSC/32, Channel 1, AD ON
		MOVWF		ADCON0

		BSF		ADCON0, GO_DONE		;Initiate conversion
		BTFSC	ADCON0,	GO_DONE		;Test that the conversion is complete?
		GOTO	$-1					; Wait for ADC to finsh

		BANKSEL	ADRESL				;Select bank

		MOVF		ADRESL
		SUBLW		.3				;If there are some voltage store them
		BTFSS		STATUS, C
		GOTO		$ + 2
		GOTO		$ + 6			; If there are no voltages goto voltage calculation

		MOVF	ADRESL				
	 	MOVWF	TEMP_VOLT_L			;Store the low byte result into TEMP_VOLT_L register
	
		BANKSEL	ADRESH				;Select bank
		MOVF	ADRESH
		MOVWF	TEMP_VOLT_H			;Store the high byte result into TEMP_VOLT_H register


;***********************;
;  VOLTAGE CALCULATIN 	;
;***********************;
			;Now we will cal the multiply rutine
			;Infact is our Basic Fromula is:-	Final_Volt = (Temp_Volt * 40000) / 1023	
			;We are measuring 40Volts from ADC
		MOVF	TEMP_VOLT_L
		MOVWF	ACC0				;Putting the value of TEMPVOLT into ACC0
		MOVF	TEMP_VOLT_H
		MOVWF	ACC1				;Putting the value of TEMPVOLT into ACC1

		CALL	ROUTINE_40000		;CALL Subroutine ROUTINE_40000 for performing action(Temp_Volt * 40000)

		CALL	ROUTINE_1023		;CALL Subroutine ROUTINE_1023 for performing action /1023

		MOVF	ACC0
		MOVWF	NumL
		MOVF	ACC1
		MOVWF	NumH
	
		CALL	ROUTINE_DEC		;CALL Subroutine ROUTINE_DEC
									;TenK:Thou:Hund:Tens:Ones

		MOVF	TenK, W			;DIGIT DISPLAY
		CALL 	NUM
		MOVWF	DIGIT+.4		

		MOVF	Thou, W			;DIGIT DISPLAY
		ADDLW	D'10'			;For showing decimal point
		CALL 	NUM
		MOVWF	DIGIT+.3	
		
		MOVF	Hund, W			;DIGIT DISPLAY
		CALL 	NUM
		MOVWF	DIGIT+.2	

		MOVF	Tens, W			;DIGIT DISPLAY
		CALL 	NUM
		MOVWF	DIGIT+.1	

		MOVF	Ones, W			;DIGIT DISPLAY
		CALL 	NUM
		MOVWF	DIGIT+.0


		END
This is the code.
It's one part voltage calculation is completed.
Other parts remaing( temperature measurement, frequency measure ment etc)
my orignal picture is not like this, my orignal picture is different from it.
I will share it later cuz that is in not completed yet.
Attached Images
File Type: gif gifwali pic.GIF (27.7 KB, 3 views)
Ayne is offline   Reply With Quote
Old 28th December 2006, 09:36 AM   (permalink)
Default

When i build this code the following 50 errors occured

Code:
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p18F452 "MultiFunction.asm" /l"MultiFunction.lst" /e"MultiFunction.err"
Warning[215] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 2 : Processor superseded by command line.  Verify processor symbol.
Warning[230] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 6 : __CONFIG has been deprecated for PIC18 devices.  Use directive CONFIG.
Error[126]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 6 : Argument out of range (not a valid config register address)
Error[113]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 82 : Symbol not previously defined (TOIF)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 113 : Found label after column 1. (RLF)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 113 : Illegal opcode (SEGMENT)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 164 : Found label after column 1. (clrc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 165 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 165 : Illegal opcode (ACC0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 166 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 166 : Illegal opcode (ACC1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 168 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 168 : Illegal opcode (ACC2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 169 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 169 : Illegal opcode (ACC0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 170 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 170 : Illegal opcode (ACC1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 171 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 171 : Illegal opcode (ACC2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 197 : Found label after column 1. (skpnz)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 199 : Found label after column 1. (skpnz)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 199 : Address label duplicated or different in second pass (skpnz)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 201 : Found label after column 1. (skpnz)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 201 : Address label duplicated or different in second pass (skpnz)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 205 : Found label after column 1. (clrc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 205 : Address label duplicated or different in second pass (clrc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 206 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 206 : Illegal opcode (TEMP0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 207 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 207 : Illegal opcode (TEMP1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 208 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 208 : Illegal opcode (TEMP2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 209 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 209 : Illegal opcode (TEMP3)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 210 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 210 : Illegal opcode (TEMP0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 211 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 211 : Illegal opcode (TEMP1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 212 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 212 : Illegal opcode (TEMP2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 213 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 213 : Illegal opcode (TEMP3)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 214 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 214 : Illegal opcode (TEMP0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 215 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 215 : Illegal opcode (TEMP1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 216 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 216 : Illegal opcode (TEMP2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 217 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 217 : Illegal opcode (TEMP3)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 223 : Found label after column 1. (skpnc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 227 : Found label after column 1. (skpnc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 227 : Address label duplicated or different in second pass (skpnc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 231 : Found label after column 1. (skpnc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 231 : Address label duplicated or different in second pass (skpnc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 236 : Found label after column 1. (clrc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 236 : Address label duplicated or different in second pass (clrc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 237 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 237 : Illegal opcode (TEMP0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 238 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 238 : Illegal opcode (TEMP1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 239 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 239 : Illegal opcode (TEMP2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 240 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 240 : Illegal opcode (TEMP3)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 241 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 241 : Illegal opcode (TEMP0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 242 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 242 : Illegal opcode (TEMP1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 243 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 243 : Illegal opcode (TEMP2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 244 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 244 : Illegal opcode (TEMP3)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 250 : Found label after column 1. (skpnc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 250 : Address label duplicated or different in second pass (skpnc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 254 : Found label after column 1. (skpnc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 254 : Address label duplicated or different in second pass (skpnc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 258 : Found label after column 1. (skpnc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 258 : Address label duplicated or different in second pass (skpnc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 296 : Found label after column 1. (clrc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 296 : Address label duplicated or different in second pass (clrc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 297 : Found label after column 1. (rrf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 297 : Illegal opcode (ACC2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 298 : Found label after column 1. (rrf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 298 : Illegal opcode (ACC1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 299 : Found label after column 1. (rrf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 299 : Illegal opcode (ACC0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 300 : Found label after column 1. (clrc)
Error[116]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 300 : Address label duplicated or different in second pass (clrc)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 301 : Found label after column 1. (rrf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 301 : Illegal opcode (ACC2)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 302 : Found label after column 1. (rrf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 302 : Illegal opcode (ACC1)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 303 : Found label after column 1. (rrf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 303 : Illegal opcode (ACC0)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 352 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 352 : Illegal opcode (Tens)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 353 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 353 : Illegal opcode (Ones)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 363 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 363 : Illegal opcode (Ones)
Warning[207] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 368 : Found label after column 1. (rlf)
Error[122]   E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 368 : Illegal opcode (Thou)
Warning[226] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 510 : Destination address must be word aligned
Warning[226] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 526 : Destination address must be word aligned
Warning[226] E:\PROJECTS\FREQUENCY COUNTER ASM\MULTIFUNCTION.ASM 536 : Destination address must be word aligned
Halting build on first failure as requested.
BUILD FAILED: Thu Dec 28 15:31:15 2006
Ayne is offline   Reply With Quote
Old 28th December 2006, 10:50 AM   (permalink)
Default

You have told MPLAB that you are using a p18F452 and you have code for a 16F877A. Change the processor type to 16F877A under the "configure/select device" menu.

Mike.
Pommie is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Need help with Intel Assembly Language and PIC16F877 avinsinanan Micro Controllers 10 4th March 2008 10:02 AM
Assembly? Marks256 Micro Controllers 43 28th July 2006 03:44 PM
Assembly compiler Thunderchild Micro Controllers 4 12th March 2006 01:25 PM
Learning Assembly Programming Language Johnson777717 Micro Controllers 4 22nd March 2004 02:00 PM
Assembly Language Question Jeggyman General Electronics Chat 6 30th January 2004 09:53 PM



All times are GMT. The time now is 05:38 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.