Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.
Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.
I still have a problem compiling with MPASM a picbasic program that includes Melabs floating point.
The program is attached to the message.
The error list that appears to me using Mpasm and the pic18f452 is here:
Executing: "c:\pbp_250\PBPW.EXE" -ampasmwin -oq -z -p18F452 "452_9912_3.pbp"
PICBASIC PRO(TM) Compiler 2.50, (c) 1998, 2007 microEngineering Labs, Inc.
All Rights Reserved.
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 805 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 1222 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 1411 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 1895 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2369 : Symbol not previously defined (fsr)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2376 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2377 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2379 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2381 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2382 : Symbol not previously defined (fsr)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2386 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2386 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2387 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2387 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2388 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2388 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2389 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2389 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2390 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2390 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2391 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2391 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2392 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2392 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2393 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2393 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2394 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2394 : Illegal opcode (_bcd)
Loaded D:\prj_active\452_9912_3.COD.
BUILD SUCCEEDED: Wed Jul 02 18:07:22 2008
Any suggestion ?
Thank you
regards,
Ambrogio
IW2FVO
It looks like your bin_bcd routine was writen for a 16F part. RLF is not an 18F instruction.
The 18F equivalent would be RLCF.
Also FSR and INDF are different on the 18F parts. You have FSR0, FSR1, FSR2, and INDF0,
INDF1, INDF2. See the 18F data sheet for details. You'll need to make a few changes to
compile this for an 18F.
Your example compiles fine with these changes to bin_bcd;
I can't say if it works or not, but it does compile without a single error.Code:bin_bcd: asm ;****************************************************************** ; Convert 32-bit binary number at <bin> into a bcd number ; at <bcd>. Uses Mike Keitz's procedure for handling bcd ; adjust; Modified Microchip AN526 for 32-bits. b2bcd movlw 32 ; 32-bits movwf _ii ; make cycle counter clrf _bcd ; clear result area clrf _bcd+1 clrf _bcd+2 clrf _bcd+3 clrf _bcd+4 b2bcd2 movlw _bcd ; make pointer movwf fsr0 movlw 5 movwf _cnt ; Mike's routine: b2bcd3 movlw 0x33 addwf indf0,f ; add to both nybbles btfsc indf0,3 ; test if low result > 7 andlw 0xf0 ; low result >7 so take the 3 out btfsc indf0,7 ; test if high result > 7 andlw 0x0f ; high result > 7 so ok subwf indf0,f ; any results <= 7, subtract back incf fsr0,f ; point to next decfsz _cnt goto b2bcd3 rlcf _binary+3,f ; get another bit rlcf _binary+2,f rlcf _binary+1,f rlcf _binary+0,f rlcf _bcd+4,f ; put it into bcd rlcf _bcd+3,f rlcf _bcd+2,f rlcf _bcd+1,f rlcf _bcd+0,f decfsz _ii,f ; all done? goto b2bcd2 ; no, loop ; yes endasm return
Hi,
I am happy because I understand that you have read the basic program but I am really interested in knowing how can my program be wtitten without using the F P.
Could you please inform how it can be done ? It will be a very interesting solution.
Thanks for the help
regards,
Ambrogio
iw2fvo
Italy
Nothing interesting about it.
Where is the program using numbers between 0 and 1? Or fractions for that matter?
All I see is numbers that go above 16 bit. If that's the case, and you are using an 18Fxxx part, then you can use LONG variables to handle 32 bit (large) numbers.
Ok , Thanks Bruce I will have a look to longs as suggested.
I am writing a program in order to control the Analog Device AD9912 DDS: this device will be used as a RF signal generator for radio ham use. The point is that I have to multiply a number as like as
2^48/1000000000 ( 281474.976711) by another number that is the readout of the real output frequency ( from 1 Hz to 400 MHz ) . At the moment the Melabs FP works well and gives me the correct output frequency.
Unfortunately i can not put the " DDS" piece of program in a subroutine : in this case i do have no errors after compiling but the 16F877 does not work.
And, if I recall the "DDS" piece of program more than three times in my program i do have the same result.
>> question: how can i set the HS oscillator using the Mpasm and pic16f877 with no problem ?
Thanks a lot.
Ambrogio
IW2FVO
Hi,
thanks for the interest:
this is the peace of program that in my opinion needs a fp:
'DDS: '------------------------------------------------------------------------
AARGB0=f0
AARGB1=f1
AARGB2=f2
AARGB3=f3
ASM
CALL flo3232
ENDASM
debug HEX2 f0," ", HEX2 f1," ", HEX2 f2, " " , HEX2 f3, 13,10
' CALCOLO DELLA FTW DA INVIARE AL DDS
' 2^48/1.000.000.000= 281474,976710656
' USARE IL PROGRAMMA FREP.EXE DELLE ROUTINES FP PER CONVERTIRLO DIRETTAMENTE
' ATTENZIONE: USARE $81 INVECE DI 91 PERCHE' I 2 BYTE MENO SIGNUFICATIVI LI LASCIO
' A ZERO ( VEDERE MAIL DI i0cg )
BEXP=$81
BARGB0=$09
BARGB1=$70
BARGB2=$5F
GOSUB FPMUL
ASM
CALL INT3232
ENDASM
'debug " start ",dec aargb0," ",dec aargb1," ", dec aargb2," ",dec aargb3,13,10
LOW DDSCSB
'SHIFTOUT DDSDAT,DDSCLK,1,[%01100001,%10101011,aargb0,aargb1,aargb2,aargb3,$0 0,$00]
HIGH DDSCSB
HIGH DDSUPDT
LOW DDSUPDT
-------------------------------------------------------------------------------------
Have you some differents indication for me ?
( I am sorry for my bad English .. I am Italian )
Sometimes is very hard for me to understand the real meaning of the things !
Thanks again
Ambrogio
IW2FVO
Bookmarks