Hello all, I have been attempting to make use of Karl Lunt's PIC Macros with no success during the build phase. I have followed his instructions and emailed him for help with no response. I'm using MPLab 6.20 and writing some test code for the 16F84A. The following text describes my code and the errors upon build. Could anyone take a look and see if you could provide some insight? Thanks in advance for any help. Regards, Stephen D. Barnes My code follows: ********************************************************************** *** ERRORLEVEL -224 ; suppress message because of tris ERRORLEVEL -302 ; suppress message because of page change list pF84A ; list directive to define processor #include <p16F84A.inc> ; processor specific variable definitions #include ".\macros.asm" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ; '__CONFIG' directive is used to embed configuration data within .asm file. ; The lables following the directive are located in the respective .inc file. ; See respective data sheet for additional information on configuration word. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;;;;;;;;;;;;; ORG 0x000 ; processor reset vector goto Main ; go to beginning of program ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;;;;;;;;;;;;; Main: clrf PORTB ; PORTB all outputs cleared bsf STATUS,5 ; Switch to Register Bank 1 for TRIS movlw B'11111111' ; all bits high in W movwf TRISA ; contents of W copied to TRISA (PORTA all inputs) movlw B'00000000' ; all bits low in W movwf TRISB ; contents of W copied to TRISB (PORTB all outputs) movlw 0 ; 0 in W movwf OPTION_REG ; contents of W copied to OPTION_REG (Port B pullups enabled) bcf STATUS,5 ; Switch back to Register Bank 0 movf PORTA ,0 ; move PORTA bit 0 to W register case 3 call Reverse endcase case 2 call Left endcase case 1 call Right endcase Reverse: return Left: return Right: return end ********************************************************************** *** When I build I get the following error: ********************************************************************** **** Executing: "E:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" Executing: "E:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" Skipping link step. The project contains no linker script. BUILD FAILED ********************************************************************** **** Soooo... I created a linker script conforming to MPASM spec which reads as follows and is part of the MPLab project: ********************************************************************** **** FILES macros.o test1.o ********************************************************************** **** Build now reports the following error: ********************************************************************** **** Executing: "E:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" Executing: "E:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" Executing: "E:\Program Files\MPLAB IDE\MCHIP_Tools\mplink.exe" "test1.lkr" "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" MPLINK 3.30, Linker Copyright (c) 2003 Microchip Technology Inc. Error - section '.cinit' can not fit the section. Section '.cinit' length=0x00000004 Errors : 1 BUILD FAILED ********************************************************************** **** |
|
Need help with PIC Macros
Started by ●April 16, 2003
Reply by ●April 16, 20032003-04-16
Hello again! Put 'select' as an instruction before the first 'case' statement and put 'endselect' as as instruction after the last 'endcase' statement. Also, change the file name to Macros.inc and change the include statement to match. You do NOT want to assemble separately the macro library as it contains only definitions. No code is emitted until the macro is envoked (or expanded if you will). Lacking the documentation make the library hard to use. If you see these kinds of errors, look at the variable that was undefined and see where the macro library was emitting that code (the line number in the error message). Then wander around and find out why. Documentation would be better. One thing to look at - the comment on the 'movf PORTA,0' is incorrect because you are moving the entire 8 bit PORTA byte to W. More serious, using 0 instead of W for the destination makes the instruction hard to read. Both W and F are defined in the 16F84a include file - you don't need to define them. I haven't played with this particular macro library but when I saw it a while back I thought it was rather well done. Enjoy! --- In , "stephendbarnes" <stephendbarnes@h...> wrote: > Hello all, > I have been attempting to make use of Karl Lunt's PIC Macros with no > success > during the build phase. I have followed his instructions and emailed > him for > help with no response. I'm using MPLab 6.20 and writing some test > code for > the 16F84A. The > following text describes my code and the errors upon build. Could > anyone > take a look and see if you could provide some insight? Thanks in > advance for > any help. > > Regards, > Stephen D. Barnes > > My code follows: ********************************************************************** > *** > ERRORLEVEL -224 ; suppress message because of tris > ERRORLEVEL -302 ; suppress message because of page > change > > list pF84A ; list directive to define > processor > #include <p16F84A.inc> ; processor specific variable > definitions > #include ".\macros.asm" > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > ; '__CONFIG' directive is used to embed configuration data > within .asm file. > ; The lables following the directive are located in the > respective .inc > file. > ; See respective data sheet for additional information on > configuration > word. > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > ORG 0x000 ; processor reset vector > goto Main ; go to beginning of program > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > Main: > clrf PORTB ; PORTB all outputs cleared > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > movlw B'11111111' ; all bits high in W > movwf TRISA ; contents of W copied to TRISA (PORTA > all > inputs) > movlw B'00000000' ; all bits low in W > movwf TRISB ; contents of W copied to TRISB (PORTB > all > outputs) > movlw 0 ; 0 in W > movwf OPTION_REG ; contents of W copied to OPTION_REG (Port > B > pullups > enabled) > bcf STATUS,5 ; Switch back to Register Bank 0 > > movf PORTA ,0 ; move PORTA bit 0 to W register > > case 3 > call Reverse > endcase > > case 2 > call Left > endcase > > case 1 > call Right > endcase > > Reverse: > return > Left: > return > Right: > return > > end > ********************************************************************** > *** > > When I build I get the following error: ********************************************************************** > **** > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > Skipping link step. The project contains no linker script. > BUILD FAILED > ********************************************************************** > **** > > Soooo... I created a linker script conforming to MPASM spec which > reads as > follows and is part of the MPLab project: ********************************************************************** > **** > FILES macros.o test1.o > ********************************************************************** > **** > > Build now reports the following error: ********************************************************************** > **** > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > MPLINK 3.30, Linker > Copyright (c) 2003 Microchip Technology Inc. > Error - section '.cinit' can not fit the section. Section '.cinit' > length=0x00000004 > Errors : 1 > BUILD FAILED > ********************************************************************** > **** |
|
Reply by ●April 16, 20032003-04-16
Another 'readability' issue - you might think about using BANKSEL TRISA instead of BSF STATUS,5. Then you can change to bank 0 for PORTA by BANKSEL PORTA instead of BCF STATUS,5. See the help file but the short answer is that you can move quickly to the bank of ANY variable and you don't have to remember where you put it. Maybe not much of a problem with the 16F84a but the 16F877 has a 4 banks to contend with. --- In , "stephendbarnes" <stephendbarnes@h...> wrote: > Hello all, > I have been attempting to make use of Karl Lunt's PIC Macros with no > success > during the build phase. I have followed his instructions and emailed > him for > help with no response. I'm using MPLab 6.20 and writing some test > code for > the 16F84A. The > following text describes my code and the errors upon build. Could > anyone > take a look and see if you could provide some insight? Thanks in > advance for > any help. > > Regards, > Stephen D. Barnes > > My code follows: ********************************************************************** > *** > ERRORLEVEL -224 ; suppress message because of tris > ERRORLEVEL -302 ; suppress message because of page > change > > list pF84A ; list directive to define > processor > #include <p16F84A.inc> ; processor specific variable > definitions > #include ".\macros.asm" > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > ; '__CONFIG' directive is used to embed configuration data > within .asm file. > ; The lables following the directive are located in the > respective .inc > file. > ; See respective data sheet for additional information on > configuration > word. > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > ORG 0x000 ; processor reset vector > goto Main ; go to beginning of program > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > Main: > clrf PORTB ; PORTB all outputs cleared > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > movlw B'11111111' ; all bits high in W > movwf TRISA ; contents of W copied to TRISA (PORTA > all > inputs) > movlw B'00000000' ; all bits low in W > movwf TRISB ; contents of W copied to TRISB (PORTB > all > outputs) > movlw 0 ; 0 in W > movwf OPTION_REG ; contents of W copied to OPTION_REG (Port > B > pullups > enabled) > bcf STATUS,5 ; Switch back to Register Bank 0 > > movf PORTA ,0 ; move PORTA bit 0 to W register > > case 3 > call Reverse > endcase > > case 2 > call Left > endcase > > case 1 > call Right > endcase > > Reverse: > return > Left: > return > Right: > return > > end > ********************************************************************** > *** > > When I build I get the following error: ********************************************************************** > **** > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > Skipping link step. The project contains no linker script. > BUILD FAILED > ********************************************************************** > **** > > Soooo... I created a linker script conforming to MPASM spec which > reads as > follows and is part of the MPLab project: ********************************************************************** > **** > FILES macros.o test1.o > ********************************************************************** > **** > > Build now reports the following error: ********************************************************************** > **** > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > MPLINK 3.30, Linker > Copyright (c) 2003 Microchip Technology Inc. > Error - section '.cinit' can not fit the section. Section '.cinit' > length=0x00000004 > Errors : 1 > BUILD FAILED > ********************************************************************** > **** |
|
Reply by ●April 16, 20032003-04-16
Thanks to "rtstofer" for both replies. I' going to try out
your suggestions. Thanks again for all the excellent help! Regards, Steve --- In , "rtstofer" <rstofer@p...> wrote: > > Hello again! > > Put 'select' as an instruction before the first 'case' statement and > put 'endselect' as as instruction after the last 'endcase' > statement. Also, change the file name to Macros.inc and change the > include statement to match. You do NOT want to assemble separately > the macro library as it contains only definitions. No code is > emitted until the macro is envoked (or expanded if you will). > > Lacking the documentation make the library hard to use. If you see > these kinds of errors, look at the variable that was undefined and > see where the macro library was emitting that code (the line number > in the error message). Then wander around and find out why. > Documentation would be better. > > One thing to look at - the comment on the 'movf PORTA,0' is incorrect > because you are moving the entire 8 bit PORTA byte to W. More > serious, using 0 instead of W for the destination makes the > instruction hard to read. Both W and F are defined in the 16F84a > include file - you don't need to define them. > > I haven't played with this particular macro library but when I saw it > a while back I thought it was rather well done. Enjoy! > > --- In , "stephendbarnes" > <stephendbarnes@h...> wrote: > > Hello all, > > I have been attempting to make use of Karl Lunt's PIC Macros with > no > > success > > during the build phase. I have followed his instructions and > emailed > > him for > > help with no response. I'm using MPLab 6.20 and writing some test > > code for > > the 16F84A. The > > following text describes my code and the errors upon build. Could > > anyone > > take a look and see if you could provide some insight? Thanks in > > advance for > > any help. > > > > Regards, > > Stephen D. Barnes > > > > My code follows: > > > > > ********************************************************************** > > *** > > ERRORLEVEL -224 ; suppress message because of tris > > ERRORLEVEL -302 ; suppress message because of page > > change > > > > list pF84A ; list directive to define > > processor > > #include <p16F84A.inc> ; processor specific variable > > definitions > > #include ".\macros.asm" > > > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > > > ; '__CONFIG' directive is used to embed configuration data > > within .asm file. > > ; The lables following the directive are located in the > > respective .inc > > file. > > ; See respective data sheet for additional information on > > configuration > > word. > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > ORG 0x000 ; processor reset vector > > goto Main ; go to beginning of program > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > Main: > > clrf PORTB ; PORTB all outputs cleared > > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > > movlw B'11111111' ; all bits high in W > > movwf TRISA ; contents of W copied to TRISA > (PORTA > > all > > inputs) > > movlw B'00000000' ; all bits low in W > > movwf TRISB ; contents of W copied to TRISB > (PORTB > > all > > outputs) > > movlw 0 ; 0 in W > > movwf OPTION_REG ; contents of W copied to OPTION_REG > (Port > > B > > pullups > > enabled) > > bcf STATUS,5 ; Switch back to Register Bank 0 > > > > movf PORTA ,0 ; move PORTA bit 0 to W register > > > > case 3 > > call Reverse > > endcase > > > > case 2 > > call Left > > endcase > > > > case 1 > > call Right > > endcase > > > > Reverse: > > return > > Left: > > return > > Right: > > return > > > > end > > > ********************************************************************** > > *** > > > > When I build I get the following error: > > > > > ********************************************************************** > > **** > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > Skipping link step. The project contains no linker script. > > BUILD FAILED > > > ********************************************************************** > > **** > > > > Soooo... I created a linker script conforming to MPASM spec which > > reads as > > follows and is part of the MPLab project: > > > > > ********************************************************************** > > **** > > FILES macros.o test1.o > > > ********************************************************************** > > **** > > > > Build now reports the following error: > > > > > ********************************************************************** > > **** > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > > MPLINK 3.30, Linker > > Copyright (c) 2003 Microchip Technology Inc. > > Error - section '.cinit' can not fit the section. Section '.cinit' > > length=0x00000004 > > Errors : 1 > > BUILD FAILED > > > ********************************************************************** > > **** |
Reply by ●April 16, 20032003-04-16
I'm back! Tried out your suggestions and it compiled with no errors,
BUT, when I attempt to debug using MPLab SIM I get no colored pointer next to the line numbers and "step into" does not appear to work. Is this because of the inclusion of the macros? Also, the compiled hex file is only six bytes. Any clues or should I just abandon the macros and bite the bullet and learn to hard code this stuff? Regards, Steve --- In , "rtstofer" <rstofer@p...> wrote: > > Another 'readability' issue - you might think about using BANKSEL > TRISA instead of BSF STATUS,5. Then you can change to bank 0 for > PORTA by BANKSEL PORTA instead of BCF STATUS,5. > > See the help file but the short answer is that you can move quickly > to the bank of ANY variable and you don't have to remember where you > put it. Maybe not much of a problem with the 16F84a but the 16F877 > has a 4 banks to contend with. > --- In , "stephendbarnes" > <stephendbarnes@h...> wrote: > > Hello all, > > I have been attempting to make use of Karl Lunt's PIC Macros with > no > > success > > during the build phase. I have followed his instructions and > emailed > > him for > > help with no response. I'm using MPLab 6.20 and writing some test > > code for > > the 16F84A. The > > following text describes my code and the errors upon build. Could > > anyone > > take a look and see if you could provide some insight? Thanks in > > advance for > > any help. > > > > Regards, > > Stephen D. Barnes > > > > My code follows: > > > > > ********************************************************************** > > *** > > ERRORLEVEL -224 ; suppress message because of tris > > ERRORLEVEL -302 ; suppress message because of page > > change > > > > list pF84A ; list directive to define > > processor > > #include <p16F84A.inc> ; processor specific variable > > definitions > > #include ".\macros.asm" > > > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > > > ; '__CONFIG' directive is used to embed configuration data > > within .asm file. > > ; The lables following the directive are located in the > > respective .inc > > file. > > ; See respective data sheet for additional information on > > configuration > > word. > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > ORG 0x000 ; processor reset vector > > goto Main ; go to beginning of program > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > Main: > > clrf PORTB ; PORTB all outputs cleared > > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > > movlw B'11111111' ; all bits high in W > > movwf TRISA ; contents of W copied to TRISA > (PORTA > > all > > inputs) > > movlw B'00000000' ; all bits low in W > > movwf TRISB ; contents of W copied to TRISB > (PORTB > > all > > outputs) > > movlw 0 ; 0 in W > > movwf OPTION_REG ; contents of W copied to OPTION_REG > (Port > > B > > pullups > > enabled) > > bcf STATUS,5 ; Switch back to Register Bank 0 > > > > movf PORTA ,0 ; move PORTA bit 0 to W register > > > > case 3 > > call Reverse > > endcase > > > > case 2 > > call Left > > endcase > > > > case 1 > > call Right > > endcase > > > > Reverse: > > return > > Left: > > return > > Right: > > return > > > > end > > > ********************************************************************** > > *** > > > > When I build I get the following error: > > > > > ********************************************************************** > > **** > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > Skipping link step. The project contains no linker script. > > BUILD FAILED > > > ********************************************************************** > > **** > > > > Soooo... I created a linker script conforming to MPASM spec which > > reads as > > follows and is part of the MPLab project: > > > > > ********************************************************************** > > **** > > FILES macros.o test1.o > > > ********************************************************************** > > **** > > > > Build now reports the following error: > > > > > ********************************************************************** > > **** > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > > MPLINK 3.30, Linker > > Copyright (c) 2003 Microchip Technology Inc. > > Error - section '.cinit' can not fit the section. Section '.cinit' > > length=0x00000004 > > Errors : 1 > > BUILD FAILED > > > ********************************************************************** > > **** |
|
Reply by ●April 17, 20032003-04-17
No, don't give up on the concept of macros although the NEXTF macro is incorrect. Doesn't matter, you're not using it. But it shows that you can't trust anybody's code - and particularly not mine. When I assemble the code I get a map at the end of the .lst file that shows 38 words used and an additional 'x' where the status word is programmed. You show see this as well. The list file is 900 lines long! Probably should do a NOLIST before the '#include <macros.inc> and a LIST after it. This will cut the listing down to about 260 lines - but the map is the same. One thing I did (although it doesn't matter) is to move the .inc file to the same directory as the other 'includes' "C:\Program Files\MPLAB IDE\MCHIP_Tools". Are you using MPLAB IDE 6.10.0.0 or later? If so, I would expect your list file to be on the order of 900 lines with 38 words emitted. On my machine I can definitely step through the code include walking through the macros as they are expanded. Step by step perfectly. Of course after the endselect macro the code 'falls' into reverse, executes a return to nowhere and starts over again a Main. You should probably put a label ahead of the 'select' and a 'goto MyNewLabel just after the 'endselect' Don't know what else to say, it works over here! --- In , "stephendbarnes" <stephendbarnes@h...> wrote: > I'm back! Tried out your suggestions and it compiled with no errors, > BUT, when I attempt to debug using MPLab SIM I get no colored pointer > next to the line numbers and "step into" does not appear to work. Is > this because of the inclusion of the macros? Also, the compiled hex > file is only six bytes. Any clues or should I just abandon the macros > and bite the bullet and learn to hard code this stuff? > > Regards, > Steve > > --- In , "rtstofer" <rstofer@p...> wrote: > > > > Another 'readability' issue - you might think about using BANKSEL > > TRISA instead of BSF STATUS,5. Then you can change to bank 0 for > > PORTA by BANKSEL PORTA instead of BCF STATUS,5. > > > > See the help file but the short answer is that you can move quickly > > to the bank of ANY variable and you don't have to remember where > you > > put it. Maybe not much of a problem with the 16F84a but the 16F877 > > has a 4 banks to contend with. > > > > > > --- In , "stephendbarnes" > > <stephendbarnes@h...> wrote: > > > Hello all, > > > I have been attempting to make use of Karl Lunt's PIC Macros with > > no > > > success > > > during the build phase. I have followed his instructions and > > emailed > > > him for > > > help with no response. I'm using MPLab 6.20 and writing some test > > > code for > > > the 16F84A. The > > > following text describes my code and the errors upon build. Could > > > anyone > > > take a look and see if you could provide some insight? Thanks in > > > advance for > > > any help. > > > > > > Regards, > > > Stephen D. Barnes > > > > > > My code follows: > > > > > > > > > ********************************************************************** > > > *** > > > ERRORLEVEL -224 ; suppress message because of tris > > > ERRORLEVEL -302 ; suppress message because of > page > > > change > > > > > > list pF84A ; list directive to > define > > > processor > > > #include <p16F84A.inc> ; processor specific variable > > > definitions > > > #include ".\macros.asm" > > > > > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > > > > > ; '__CONFIG' directive is used to embed configuration data > > > within .asm file. > > > ; The lables following the directive are located in the > > > respective .inc > > > file. > > > ; See respective data sheet for additional information on > > > configuration > > > word. > > > > > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > ORG 0x000 ; processor reset vector > > > goto Main ; go to beginning of program > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > Main: > > > clrf PORTB ; PORTB all outputs cleared > > > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > > > movlw B'11111111' ; all bits high in W > > > movwf TRISA ; contents of W copied to TRISA > > (PORTA > > > all > > > inputs) > > > movlw B'00000000' ; all bits low in W > > > movwf TRISB ; contents of W copied to TRISB > > (PORTB > > > all > > > outputs) > > > movlw 0 ; 0 in W > > > movwf OPTION_REG ; contents of W copied to OPTION_REG > > (Port > > > B > > > pullups > > > enabled) > > > bcf STATUS,5 ; Switch back to Register Bank 0 > > > > > > movf PORTA ,0 ; move PORTA bit 0 to W register > > > > > > case 3 > > > call Reverse > > > endcase > > > > > > case 2 > > > call Left > > > endcase > > > > > > case 1 > > > call Right > > > endcase > > > > > > Reverse: > > > return > > > Left: > > > return > > > Right: > > > return > > > > > > end > > > > > > ********************************************************************** > > > *** > > > > > > When I build I get the following error: > > > > > > > > > ********************************************************************** > > > **** > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > > Skipping link step. The project contains no linker script. > > > BUILD FAILED > > > > > > ********************************************************************** > > > **** > > > > > > Soooo... I created a linker script conforming to MPASM spec which > > > reads as > > > follows and is part of the MPLab project: > > > > > > > > > ********************************************************************** > > > **** > > > FILES macros.o test1.o > > > > > > ********************************************************************** > > > **** > > > > > > Build now reports the following error: > > > > > > > > > ********************************************************************** > > > **** > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > > > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > > > MPLINK 3.30, Linker > > > Copyright (c) 2003 Microchip Technology Inc. > > > Error - section '.cinit' can not fit the section. Section '.cinit' > > > length=0x00000004 > > > Errors : 1 > > > BUILD FAILED > > > > > > ********************************************************************** > > > **** |
Reply by ●April 17, 20032003-04-17
Also, as a programming issue, the select statement will execute the 'default' statements (those between the last endcase and the endselect) if the value in W is not one of the tested cases. This might be ok - you don't have any default statements. But you might want to force W to have only those bits under consideration: ..MOVF PORTA,W ..ANDLW B'00000011' ; look at bits 0..1 only ..select ....case 0 ......call something ....endcase .... ....case 1 ......call something_else ....endcase .... ....case 2 ......call something ....endcase .... ....case 3 ......; ignore this case ....endcase ..endselect Here every potential value has been handled - no possibility of input without matching code. Just being pedantic - I hate it when I do that! --- In , "stephendbarnes" <stephendbarnes@h...> wrote: > I'm back! Tried out your suggestions and it compiled with no errors, > BUT, when I attempt to debug using MPLab SIM I get no colored pointer > next to the line numbers and "step into" does not appear to work. Is > this because of the inclusion of the macros? Also, the compiled hex > file is only six bytes. Any clues or should I just abandon the macros > and bite the bullet and learn to hard code this stuff? > > Regards, > Steve > > --- In , "rtstofer" <rstofer@p...> wrote: > > > > Another 'readability' issue - you might think about using BANKSEL > > TRISA instead of BSF STATUS,5. Then you can change to bank 0 for > > PORTA by BANKSEL PORTA instead of BCF STATUS,5. > > > > See the help file but the short answer is that you can move quickly > > to the bank of ANY variable and you don't have to remember where > you > > put it. Maybe not much of a problem with the 16F84a but the 16F877 > > has a 4 banks to contend with. > > > > > > --- In , "stephendbarnes" > > <stephendbarnes@h...> wrote: > > > Hello all, > > > I have been attempting to make use of Karl Lunt's PIC Macros with > > no > > > success > > > during the build phase. I have followed his instructions and > > emailed > > > him for > > > help with no response. I'm using MPLab 6.20 and writing some test > > > code for > > > the 16F84A. The > > > following text describes my code and the errors upon build. Could > > > anyone > > > take a look and see if you could provide some insight? Thanks in > > > advance for > > > any help. > > > > > > Regards, > > > Stephen D. Barnes > > > > > > My code follows: > > > > > > > > > ********************************************************************** > > > *** > > > ERRORLEVEL -224 ; suppress message because of tris > > > ERRORLEVEL -302 ; suppress message because of > page > > > change > > > > > > list pF84A ; list directive to > define > > > processor > > > #include <p16F84A.inc> ; processor specific variable > > > definitions > > > #include ".\macros.asm" > > > > > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > > > > > ; '__CONFIG' directive is used to embed configuration data > > > within .asm file. > > > ; The lables following the directive are located in the > > > respective .inc > > > file. > > > ; See respective data sheet for additional information on > > > configuration > > > word. > > > > > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > ORG 0x000 ; processor reset vector > > > goto Main ; go to beginning of program > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > Main: > > > clrf PORTB ; PORTB all outputs cleared > > > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > > > movlw B'11111111' ; all bits high in W > > > movwf TRISA ; contents of W copied to TRISA > > (PORTA > > > all > > > inputs) > > > movlw B'00000000' ; all bits low in W > > > movwf TRISB ; contents of W copied to TRISB > > (PORTB > > > all > > > outputs) > > > movlw 0 ; 0 in W > > > movwf OPTION_REG ; contents of W copied to OPTION_REG > > (Port > > > B > > > pullups > > > enabled) > > > bcf STATUS,5 ; Switch back to Register Bank 0 > > > > > > movf PORTA ,0 ; move PORTA bit 0 to W register > > > > > > case 3 > > > call Reverse > > > endcase > > > > > > case 2 > > > call Left > > > endcase > > > > > > case 1 > > > call Right > > > endcase > > > > > > Reverse: > > > return > > > Left: > > > return > > > Right: > > > return > > > > > > end > > > > > > ********************************************************************** > > > *** > > > > > > When I build I get the following error: > > > > > > > > > ********************************************************************** > > > **** > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > > Skipping link step. The project contains no linker script. > > > BUILD FAILED > > > > > > ********************************************************************** > > > **** > > > > > > Soooo... I created a linker script conforming to MPASM spec which > > > reads as > > > follows and is part of the MPLab project: > > > > > > > > > ********************************************************************** > > > **** > > > FILES macros.o test1.o > > > > > > ********************************************************************** > > > **** > > > > > > Build now reports the following error: > > > > > > > > > ********************************************************************** > > > **** > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > > > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > > > MPLINK 3.30, Linker > > > Copyright (c) 2003 Microchip Technology Inc. > > > Error - section '.cinit' can not fit the section. Section '.cinit' > > > length=0x00000004 > > > Errors : 1 > > > BUILD FAILED > > > > > > ********************************************************************** > > > **** |
|
Reply by ●April 17, 20032003-04-17
OOPS! Of course the new label in my prior message goes ahead of the MOVF PORTA,W. Comes from typing without thinking. --- In , "stephendbarnes" <stephendbarnes@h...> wrote: > Hello all, > I have been attempting to make use of Karl Lunt's PIC Macros with no > success > during the build phase. I have followed his instructions and emailed > him for > help with no response. I'm using MPLab 6.20 and writing some test > code for > the 16F84A. The > following text describes my code and the errors upon build. Could > anyone > take a look and see if you could provide some insight? Thanks in > advance for > any help. > > Regards, > Stephen D. Barnes > > My code follows: ********************************************************************** > *** > ERRORLEVEL -224 ; suppress message because of tris > ERRORLEVEL -302 ; suppress message because of page > change > > list pF84A ; list directive to define > processor > #include <p16F84A.inc> ; processor specific variable > definitions > #include ".\macros.asm" > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > ; '__CONFIG' directive is used to embed configuration data > within .asm file. > ; The lables following the directive are located in the > respective .inc > file. > ; See respective data sheet for additional information on > configuration > word. > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > ORG 0x000 ; processor reset vector > goto Main ; go to beginning of program > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;;;; > ;;;;;;;;;;;;;;;;; > Main: > clrf PORTB ; PORTB all outputs cleared > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > movlw B'11111111' ; all bits high in W > movwf TRISA ; contents of W copied to TRISA (PORTA > all > inputs) > movlw B'00000000' ; all bits low in W > movwf TRISB ; contents of W copied to TRISB (PORTB > all > outputs) > movlw 0 ; 0 in W > movwf OPTION_REG ; contents of W copied to OPTION_REG (Port > B > pullups > enabled) > bcf STATUS,5 ; Switch back to Register Bank 0 > > movf PORTA ,0 ; move PORTA bit 0 to W register > > case 3 > call Reverse > endcase > > case 2 > call Left > endcase > > case 1 > call Right > endcase > > Reverse: > return > Left: > return > Right: > return > > end > ********************************************************************** > *** > > When I build I get the following error: ********************************************************************** > **** > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > Skipping link step. The project contains no linker script. > BUILD FAILED > ********************************************************************** > **** > > Soooo... I created a linker script conforming to MPASM spec which > reads as > follows and is part of the MPLab project: ********************************************************************** > **** > FILES macros.o test1.o > ********************************************************************** > **** > > Build now reports the following error: ********************************************************************** > **** > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > Executing: "E:\Program Files\MPLAB > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > MPLINK 3.30, Linker > Copyright (c) 2003 Microchip Technology Inc. > Error - section '.cinit' can not fit the section. Section '.cinit' > length=0x00000004 > Errors : 1 > BUILD FAILED > ********************************************************************** > **** |
|
Reply by ●April 17, 20032003-04-17
I think I see what is happening but I don't know what to do about it.
The compiler is actually not looking at my code at all! When it gets to the "#include macros.inc" it compiles the macros and skips the rest of my source! If you would like to see the .lst I'll post it for you to look at. Thanks again for your help. Regards, Steve --- In , "rtstofer" <rstofer@p...> wrote: > > OOPS! Of course the new label in my prior message goes ahead of the > MOVF PORTA,W. Comes from typing without thinking. > > --- In , "stephendbarnes" > <stephendbarnes@h...> wrote: > > Hello all, > > I have been attempting to make use of Karl Lunt's PIC Macros with > no > > success > > during the build phase. I have followed his instructions and > emailed > > him for > > help with no response. I'm using MPLab 6.20 and writing some test > > code for > > the 16F84A. The > > following text describes my code and the errors upon build. Could > > anyone > > take a look and see if you could provide some insight? Thanks in > > advance for > > any help. > > > > Regards, > > Stephen D. Barnes > > > > My code follows: > > > > > ********************************************************************** > > *** > > ERRORLEVEL -224 ; suppress message because of tris > > ERRORLEVEL -302 ; suppress message because of page > > change > > > > list pF84A ; list directive to define > > processor > > #include <p16F84A.inc> ; processor specific variable > > definitions > > #include ".\macros.asm" > > > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > > > ; '__CONFIG' directive is used to embed configuration data > > within .asm file. > > ; The lables following the directive are located in the > > respective .inc > > file. > > ; See respective data sheet for additional information on > > configuration > > word. > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > ORG 0x000 ; processor reset vector > > goto Main ; go to beginning of program > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > ;;;;;; > > ;;;;;;;;;;;;;;;;; > > Main: > > clrf PORTB ; PORTB all outputs cleared > > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > > movlw B'11111111' ; all bits high in W > > movwf TRISA ; contents of W copied to TRISA > (PORTA > > all > > inputs) > > movlw B'00000000' ; all bits low in W > > movwf TRISB ; contents of W copied to TRISB > (PORTB > > all > > outputs) > > movlw 0 ; 0 in W > > movwf OPTION_REG ; contents of W copied to OPTION_REG > (Port > > B > > pullups > > enabled) > > bcf STATUS,5 ; Switch back to Register Bank 0 > > > > movf PORTA ,0 ; move PORTA bit 0 to W register > > > > case 3 > > call Reverse > > endcase > > > > case 2 > > call Left > > endcase > > > > case 1 > > call Right > > endcase > > > > Reverse: > > return > > Left: > > return > > Right: > > return > > > > end > > > ********************************************************************** > > *** > > > > When I build I get the following error: > > > > > ********************************************************************** > > **** > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > Skipping link step. The project contains no linker script. > > BUILD FAILED > > > ********************************************************************** > > **** > > > > Soooo... I created a linker script conforming to MPASM spec which > > reads as > > follows and is part of the MPLab project: > > > > > ********************************************************************** > > **** > > FILES macros.o test1.o > > > ********************************************************************** > > **** > > > > Build now reports the following error: > > > > > ********************************************************************** > > **** > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > Executing: "E:\Program Files\MPLAB > > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > > MPLINK 3.30, Linker > > Copyright (c) 2003 Microchip Technology Inc. > > Error - section '.cinit' can not fit the section. Section '.cinit' > > length=0x00000004 > > Errors : 1 > > BUILD FAILED > > > ********************************************************************** > > **** |
|
Reply by ●April 17, 20032003-04-17
I finally figured out how to attach a zip file - I have to send it by email to from my registered mail account. I can't do it from work so I will post it tonight. I have a zip file with the .asm, .inc and related project files - known to work. Just extract to c:\test\ and open the project in MPASM IDE. I tried to create the failure you are having and can't seem to duplicate it. Once we are both working from the same files maybe it will become clear. --- In , "stephendbarnes" <stephendbarnes@h...> wrote: > I think I see what is happening but I don't know what to do about it. > The compiler is actually not looking at my code at all! When it gets > to the "#include macros.inc" it compiles the macros and skips the > rest of my source! If you would like to see the .lst I'll post it for > you to look at. Thanks again for your help. > > Regards, > Steve > > --- In , "rtstofer" <rstofer@p...> wrote: > > > > OOPS! Of course the new label in my prior message goes ahead of the > > MOVF PORTA,W. Comes from typing without thinking. > > > > --- In , "stephendbarnes" > > <stephendbarnes@h...> wrote: > > > Hello all, > > > I have been attempting to make use of Karl Lunt's PIC Macros with > > no > > > success > > > during the build phase. I have followed his instructions and > > emailed > > > him for > > > help with no response. I'm using MPLab 6.20 and writing some test > > > code for > > > the 16F84A. The > > > following text describes my code and the errors upon build. Could > > > anyone > > > take a look and see if you could provide some insight? Thanks in > > > advance for > > > any help. > > > > > > Regards, > > > Stephen D. Barnes > > > > > > My code follows: > > > > > > > > > ********************************************************************** > > > *** > > > ERRORLEVEL -224 ; suppress message because of tris > > > ERRORLEVEL -302 ; suppress message because of > page > > > change > > > > > > list pF84A ; list directive to > define > > > processor > > > #include <p16F84A.inc> ; processor specific variable > > > definitions > > > #include ".\macros.asm" > > > > > > __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC > > > > > > ; '__CONFIG' directive is used to embed configuration data > > > within .asm file. > > > ; The lables following the directive are located in the > > > respective .inc > > > file. > > > ; See respective data sheet for additional information on > > > configuration > > > word. > > > > > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > ORG 0x000 ; processor reset vector > > > goto Main ; go to beginning of program > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > > > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;; > > > ;;;;;; > > > ;;;;;;;;;;;;;;;;; > > > Main: > > > clrf PORTB ; PORTB all outputs cleared > > > bsf STATUS,5 ; Switch to Register Bank 1 for TRIS > > > movlw B'11111111' ; all bits high in W > > > movwf TRISA ; contents of W copied to TRISA > > (PORTA > > > all > > > inputs) > > > movlw B'00000000' ; all bits low in W > > > movwf TRISB ; contents of W copied to TRISB > > (PORTB > > > all > > > outputs) > > > movlw 0 ; 0 in W > > > movwf OPTION_REG ; contents of W copied to OPTION_REG > > (Port > > > B > > > pullups > > > enabled) > > > bcf STATUS,5 ; Switch back to Register Bank 0 > > > > > > movf PORTA ,0 ; move PORTA bit 0 to W register > > > > > > case 3 > > > call Reverse > > > endcase > > > > > > case 2 > > > call Left > > > endcase > > > > > > case 1 > > > call Right > > > endcase > > > > > > Reverse: > > > return > > > Left: > > > return > > > Right: > > > return > > > > > > end > > > > > > ********************************************************************** > > > *** > > > > > > When I build I get the following error: > > > > > > > > > ********************************************************************** > > > **** > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > > Skipping link step. The project contains no linker script. > > > BUILD FAILED > > > > > > ********************************************************************** > > > **** > > > > > > Soooo... I created a linker script conforming to MPASM spec which > > > reads as > > > follows and is part of the MPLab project: > > > > > > > > > ********************************************************************** > > > **** > > > FILES macros.o test1.o > > > > > > ********************************************************************** > > > **** > > > > > > Build now reports the following error: > > > > > > > > > ********************************************************************** > > > **** > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "test1.asm" /l"test1.lst" /e"test1.err" /o"test1.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F84A > > > "MACROS.ASM" /l"MACROS.lst" /e"MACROS.err" /o"MACROS.o" > > > Executing: "E:\Program Files\MPLAB > > > IDE\MCHIP_Tools\mplink.exe" "test1.lkr" > > > "E:\PIC\test1.o" "E:\PIC\MACROS.o" /o"test1.cof" > > > MPLINK 3.30, Linker > > > Copyright (c) 2003 Microchip Technology Inc. > > > Error - section '.cinit' can not fit the section. Section '.cinit' > > > length=0x00000004 > > > Errors : 1 > > > BUILD FAILED > > > > > > ********************************************************************** > > > **** |
|