I slightly modified the first example program from the beginers book I'm reading...this is the code. It's a simple minded thing that just blinks the port b outputs endlessly...looks ok on a simulator. ;========twinkle.ASM========================================= list pf84a __config h'3ff1' radix hex ;------------------------ ; cpu equates (memory map) portb equ 0x06 ;------------------------ org 0x000 ; start movlw 0x000 ;load w with 0x00 tris portb ;copy w tristate, port B ; outputs twinkle MOVLW 0x09 SUBWF 0x06,W MOVWF 0x06 goto twinkle ;done ; end ;----------------------- ;at device programming time, select: ; code protection off ; watchdog timer disabled ; standard crystal XT (using 4 mhz osc for test) ; power-up timer on ;=========================================================== When I compile on MPLAB 557 It works and I get this Building TWINKLE.ASM... Command line: "C:\PROGRA~1\MPLAB\MPASMWIN.EXE /e+ /l+ /x- /c+ /p16F84 /q TWINKLE.ASM" Warning[215] D:\ASM-FI~1\TWINKLE.ASM 2 : Processor superceded by command line. Verify processor symbol. Warning[224] D:\ASM-FI~1\TWINKLE.ASM 12 : Use of this instruction is not recommended. Build completed successfully. Why does it hate the tris command? And what does the 'processor superceded by command line' mean? On Mplab 662 It won't compile and I get this mess :-( How must it be changed to satisfy MPLAB662? Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Program Files\MPLAB662\MCHIP_Tools\mpasmwin.exe" /q /p18F452 "twinkle.asm" /l"twinkle.lst" /e"twinkle.err" Warning[215] D:\ASM-FILES\TWINKLE.ASM 2 : Processor superseded by command line. Verify processor symbol. Error[126] D:\ASM-FILES\TWINKLE.ASM 3 : Argument out of range (not a valid config register address) Warning[207] D:\ASM-FILES\TWINKLE.ASM 12 : Found label after column 1. (tris) Error[122] D:\ASM-FILES\TWINKLE.ASM 12 : Illegal opcode (portb) Halting build on first failure as requested. BUILD FAILED: Thu Sep 30 11:35:07 2004 |
|
Help! compiler probs :-(
Started by ●September 30, 2004
Reply by ●September 30, 20042004-09-30
The TRIS instruction is deprecated (as in they
have replaced it with a new instruction - you can use it now but there is no
guarantee that in future prodcts it will be available). The TRIS
instruction avoids having to deal with bank switching.
Warnings will not stop a program working -
errors do that. The output you posted shows you have an error on line 3 and line
12. Go back and look at your code and see what the problem is. The first error
is the 3ff1, I'm not really sure why (after all I am a newbie myself) it
says it is out of range double check that you don't have an extra tab
between the __config and the rest of that line. Or notate the hex in a different
way (0x3ff1)
The second error looks like it is because you
have put a tab in front of the goto. Remove it and recompile.
Hope that helps
Nigel
|
Reply by ●September 30, 20042004-09-30
The 'tris' instruction is no longer supported! Change it either to
TRISB or manually add in bsf RP0 and then movwf portb. Label in column 1 in this case is caused by you using an unsupported instruction. MPLAB v6 and above list all the error codes not sure what the error 215 is. BUT I have just spotted that your project must be set for a 18F452 part and you are including the 16F84 part. Change the project to use a 16F84 and I reckon that error will disappear. Colin -- cdb, on Thursday,30 September,2004 I have always been a few Dendrites short of an Axon and believe me it shows. Light travels faster than sound. That's why some people appear bright until they speak! |
Reply by ●September 30, 20042004-09-30
The TRIS command is very, very old. Microchip told us a few years ago to not use it anymore. The PORTB doesn't need to be equated, the compiler knows which address it has (from the .inc-file for the '84). Kees --- oi2all <> wrote: > I slightly modified the first example program from > the beginers book I'm reading...this is the code. > It's a simple minded thing that just blinks the > port b outputs endlessly...looks ok on a simulator. ;========twinkle.ASM========================================= > list pf84a > __config h'3ff1' > radix hex > ;------------------------ > ; cpu equates (memory map) > portb equ 0x06 > ;------------------------ > org 0x000 > ; > start movlw 0x000 ;load w with 0x00 > tris portb ;copy w tristate, port B > ; outputs > twinkle MOVLW 0x09 > SUBWF 0x06,W > MOVWF 0x06 > goto twinkle ;done > ; > end > ;----------------------- > ;at device programming time, select: > ; code protection off > ; watchdog timer disabled > ; standard crystal XT (using 4 mhz osc for test) > ; power-up timer on > ;=========================================================== > > > When I compile on MPLAB 557 It works and I get this > > Building TWINKLE.ASM... > > Command line: "C:\PROGRA~1\MPLAB\MPASMWIN.EXE /e+ > /l+ /x- /c+ /p16F84 > /q TWINKLE.ASM" > Warning[215] D:\ASM-FI~1\TWINKLE.ASM 2 : Processor > superceded by > command line. Verify processor symbol. > Warning[224] D:\ASM-FI~1\TWINKLE.ASM 12 : Use of > this instruction is > not recommended. > > Build completed successfully. > > Why does it hate the tris command? > And what does the 'processor superceded by command > line' mean? > > > On Mplab 662 It won't compile and I get this mess > :-( > How must it be changed to satisfy MPLAB662? > > Clean: Deleting intermediary and output files. > > Clean: Done. > Executing: "C:\Program > Files\MPLAB662\MCHIP_Tools\mpasmwin.exe" /q > /p18F452 "twinkle.asm" /l"twinkle.lst" > /e"twinkle.err" > Warning[215] D:\ASM-FILES\TWINKLE.ASM 2 : Processor > superseded by > command line. Verify processor symbol. > Error[126] D:\ASM-FILES\TWINKLE.ASM 3 : Argument > out of range (not a > valid config register address) > Warning[207] D:\ASM-FILES\TWINKLE.ASM 12 : Found > label after column 1. > (tris) > Error[122] D:\ASM-FILES\TWINKLE.ASM 12 : Illegal > opcode (portb) > Halting build on first failure as requested. > BUILD FAILED: Thu Sep 30 11:35:07 2004 __________________________________ |
Reply by ●September 30, 20042004-09-30
One of the 'joys' of many of the beginner books is that, not only is the coding style abominable, the code itself is obsolete. Try this with the IDE and don't forget to properly select the processor with Configure-Select Device... ;========twinkle.ASM========================================= list pf84a __config h'3ff1' radix hex include "P16F84A.inc" errorlevel -302 org 0x000 ; start movlw 0x000 ;load w with 0x00 banksel TRISB movwf TRISB banksel PORTB twinkle MOVLW 0x09 SUBWF 0x06,W MOVWF PORTB goto twinkle ;done ; end Obviously, the two labels 'start' and 'twinkle' are the only two items starting in column 1 regardless of what Yahoo does to the listing. Further, as a matter of style, decide whether mnemonics are all caps as follows twinkle or lower case as follows start. Then decide on capitalization for things like TRISB and PORTB and try to be consistent. Notice also that the default radix is HEX and this is IMO a bad way to go. I usually choose DEC and specify hex constants with either (but not both) of h'00' or 0x00. But it is a matter of choice: it seems easier to me to specify a 100 iteration loop counter as MOVLW 100 MOVWF count and not have the assembler choke because it believes I want 256 iterations and the value won't fit in 'count'. If the default radix is HEX then the following is not obvious: MOVLW 10 ; set loop counter for 10 passes MOVWF count Well, that's nice. Even the comment matches. Of course, we will actually do 16 passes but hey, everyone saw the radix definition, right? It was at the top of the 40 page listing... And everyone knows better than to trust comments! Enjoy... -- In , "oi2all" <oi2all@y...> wrote: > I slightly modified the first example program from > the beginers book I'm reading...this is the code. > It's a simple minded thing that just blinks the > port b outputs endlessly...looks ok on a simulator. > > ;========twinkle.ASM========================================= > list pf84a > __config h'3ff1' > radix hex > ;------------------------ > ; cpu equates (memory map) > portb equ 0x06 > ;------------------------ > org 0x000 > ; > start movlw 0x000 ;load w with 0x00 > tris portb ;copy w tristate, port B > ; outputs > twinkle MOVLW 0x09 > SUBWF 0x06,W > MOVWF 0x06 > goto twinkle ;done > ; > end > ;----------------------- > ;at device programming time, select: > ; code protection off > ; watchdog timer disabled > ; standard crystal XT (using 4 mhz osc for test) > ; power-up timer on > ;=========================================================== > When I compile on MPLAB 557 It works and I get this > > Building TWINKLE.ASM... > > Command line: "C:\PROGRA~1\MPLAB\MPASMWIN.EXE /e+ /l+ /x- /c+ /p16F84 > /q TWINKLE.ASM" > Warning[215] D:\ASM-FI~1\TWINKLE.ASM 2 : Processor superceded by > command line. Verify processor symbol. > Warning[224] D:\ASM-FI~1\TWINKLE.ASM 12 : Use of this instruction is > not recommended. > > Build completed successfully. > > Why does it hate the tris command? > And what does the 'processor superceded by command line' mean? > > > On Mplab 662 It won't compile and I get this mess :-( > How must it be changed to satisfy MPLAB662? > > Clean: Deleting intermediary and output files. > > Clean: Done. > Executing: "C:\Program Files\MPLAB662\MCHIP_Tools\mpasmwin.exe" /q > /p18F452 "twinkle.asm" /l"twinkle.lst" /e"twinkle.err" > Warning[215] D:\ASM-FILES\TWINKLE.ASM 2 : Processor superseded by > command line. Verify processor symbol. > Error[126] D:\ASM-FILES\TWINKLE.ASM 3 : Argument out of range (not a > valid config register address) > Warning[207] D:\ASM-FILES\TWINKLE.ASM 12 : Found label after column 1. > (tris) > Error[122] D:\ASM-FILES\TWINKLE.ASM 12 : Illegal opcode (portb) > Halting build on first failure as requested. > BUILD FAILED: Thu Sep 30 11:35:07 2004 |
|
Reply by ●September 30, 20042004-09-30
Thanks mucho :-) This looks like what I need to know.. I will try it out. And I think u'r right about the abysmal state of 'beginner' books :-/ --- In , "rtstofer" <rstofer@p...> wrote: > > One of the 'joys' of many of the beginner books is that, not only is > the coding style abominable, the code itself is obsolete. > > Try this with the IDE and don't forget to properly select the > processor with Configure-Select Device... > > ;========twinkle.ASM========================================= > list pf84a > __config h'3ff1' > radix hex > include "P16F84A.inc" > errorlevel -302 > > org 0x000 > ; > start > movlw 0x000 ;load w with 0x00 > banksel TRISB > movwf TRISB > banksel PORTB > > twinkle > MOVLW 0x09 > SUBWF 0x06,W > MOVWF PORTB > goto twinkle ;done > ; > end > > Obviously, the two labels 'start' and 'twinkle' are the only two > items starting in column 1 regardless of what Yahoo does to the > listing. Further, as a matter of style, decide whether mnemonics > are all caps as follows twinkle or lower case as follows start. > Then decide on capitalization for things like TRISB and PORTB and > try to be consistent. Notice also that the default radix is HEX and > this is IMO a bad way to go. I usually choose DEC and specify hex > constants with either (but not both) of h'00' or 0x00. But it is a > matter of choice: it seems easier to me to specify a 100 iteration > loop counter as > MOVLW 100 > MOVWF count > and not have the assembler choke because it believes I want 256 > iterations and the value won't fit in 'count'. > > If the default radix is HEX then the following is not obvious: > > MOVLW 10 ; set loop counter for 10 passes > MOVWF count > > Well, that's nice. Even the comment matches. Of course, we will > actually do 16 passes but hey, everyone saw the radix definition, > right? It was at the top of the 40 page listing... And everyone > knows better than to trust comments! > > Enjoy... > |