Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | Need help with PIC Macros

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Need help with PIC Macros - stephendbarnes - Apr 16 18:35:00 2003

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 p=16F84A ; 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
**********************************************************************
****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


Re: Need help with PIC Macros - rtstofer - Apr 16 20:42:00 2003


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 p=16F84A ; 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
>
**********************************************************************
> ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - Readability issue - rtstofer - Apr 16 20:59:00 2003


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 p=16F84A ; 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
>
**********************************************************************
> ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - stephendbarnes - Apr 16 22:02:00 2003

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 p=16F84A ; 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
> >
>
**********************************************************************
> > ****




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - Readability issue - stephendbarnes - Apr 16 22:40:00 2003

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 p=16F84A ; 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
> >
>
**********************************************************************
> > ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - Readability issue - rtstofer - Apr 16 23:44:00 2003


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 p=16F84A ; 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
> > >
> >
>
**********************************************************************
> > > ****




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - Readability issue - rtstofer - Apr 16 23:52:00 2003


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 p=16F84A ; 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
> > >
> >
>
**********************************************************************
> > > ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Low voltage shutdown - Bruce Partridge - Apr 17 0:24:00 2003

I am doing an AD measurement and I need to display it correctly.  For that to happen, I think I need a constant voltage.  For example, if I am using Vref as the 5 V Vdd, and Vdd drops, then my measurement will be wrong.  The voltage I am measuring is coming from an off-board sensor.
 
I have added a voltage regulator so that I have a constant 5 volts, and will run it on batteries of more than 5 volts.  But I would like to shutdown completely rather than display wrong results.  I could measure the regulated volts, but since that would be referenced to Vdd, it wouldn't help.
 
Does anyone have a suggestion on how to do this?
 

Bruce Partridge
http://www.rebreather.ca
Vancouver, Canada

 





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - rtstofer - Apr 17 0:26:00 2003


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 p=16F84A ; 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
>
**********************************************************************
> ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Low voltage shutdown - rtstofer - Apr 17 0:40:00 2003


There are a ton of precision voltage reference devices available.
Maybe if you picked one the held +2.5V you could check to see if the
A/D got the right answer.

Among many other places, check www.maxim-ic.com/References.cfm. Note
that there is also an application guide on using precision references.

Good luck!

--- In , Bruce Partridge <bgpartri@c...> wrote:
> I am doing an AD measurement and I need to display it correctly.
For that
> to happen, I think I need a constant voltage. For example, if I am
using
> Vref as the 5 V Vdd, and Vdd drops, then my measurement will be
wrong. The
> voltage I am measuring is coming from an off-board sensor.
>
> I have added a voltage regulator so that I have a constant 5 volts,
and will
> run it on batteries of more than 5 volts. But I would like to
shutdown
> completely rather than display wrong results. I could measure the
regulated
> volts, but since that would be referenced to Vdd, it wouldn't help.
>
> Does anyone have a suggestion on how to do this?
>
> Bruce Partridge
> http://www.rebreather.ca
> Vancouver, Canada >
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - stephendbarnes - Apr 17 12:24:00 2003

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 p=16F84A ; 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
> >
>
**********************************************************************
> > ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - rtstofer - Apr 17 13:35:00 2003

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 p=16F84A ; 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
> > >
> >
>
**********************************************************************
> > > ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - stephendbarnes - Apr 17 14:03:00 2003

Thank you. I have made a little progress. I found that the compiler
was only compiling the macros.inc file and stopping there! I'm new to
this and your comments about the .lst file made me go look at it!
WOW. It reported 0 program words used! Looking at the list I saw that
none of my code was present. The problem seemed to be that Karl
Lunt's macro file has the compiler directive "end" at the end. I
assume that this was causing the compiler to stop dead in its tracks.
I removed the "end" directive from the macro file and it compiled and
simulates. I do have a problem with the thing constantly going to the
first case "case 3" and ignoring the other two regardless of the
value W. I'll be looking forward to seeing your code. I will try
debugging this myself without yelling for help at every turn (jump in
with both feet and only yell when drowning!). You have been, and are
being, an enormous help. Thanks again.

Regards,
Steve

--- In , "rtstofer" <rstofer@p...> wrote:
> 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 p=16F84A ; 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
> > > >
> > >
> >
>
**********************************************************************
> > > > ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - rtstofer - Apr 17 14:48:00 2003


We must have gotten different versions of the macros. Mine did not
have an 'end' statement but I was beginning to suspect that yours
did. That would be about the only reason for the assembler to stop
early.

I am not sure why your code would execute any case. In my version of
SIM without a stimulus file the value of PORTA is always 0. This
should not execute any case and if you have placed a goto loop
statement following endselect you should not fall into the reverse
subroutine. The label 'loop' should be before the movwf PORTA,W

An easy way to trace this code is to put a movlw 3 (or something)
immediately after the movwf PORTA,W. This will load W with a
matching value for one of the various cases. I would still mask off
the unused bits and change the select and case statements as
discussed previously.

--- In , "stephendbarnes"
<stephendbarnes@h...> wrote:
> Thank you. I have made a little progress. I found that the compiler
> was only compiling the macros.inc file and stopping there! I'm new
to
> this and your comments about the .lst file made me go look at it!
> WOW. It reported 0 program words used! Looking at the list I saw
that
> none of my code was present. The problem seemed to be that Karl
> Lunt's macro file has the compiler directive "end" at the end. I
> assume that this was causing the compiler to stop dead in its
tracks.
> I removed the "end" directive from the macro file and it compiled
and
> simulates. I do have a problem with the thing constantly going to
the
> first case "case 3" and ignoring the other two regardless of the
> value W. I'll be looking forward to seeing your code. I will try
> debugging this myself without yelling for help at every turn (jump
in
> with both feet and only yell when drowning!). You have been, and
are
> being, an enormous help. Thanks again.
>
> Regards,
> Steve
>
> --- In , "rtstofer" <rstofer@p...> wrote:
> > 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 p=16F84A ; 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
> > > > >
> > > >
> > >
> >
>
**********************************************************************
> > > > > ****





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Need help with PIC Macros - rtstofer - Apr 17 15:22:00 2003


Just to check the version of the macros, look at nextf and it should
look like this (after I revised it):

nextf...macro..var,incf
_nxtknt.set...._nxtknt-1
........movf...incf,w..; the code was incorrect here
........addwf..var,f...; leave the result in var, not incf
........goto..._for#v(_nxtknt)
_next#v(_nxtknt)
........endm

--- In , "rtstofer" <rstofer@p...> wrote:
>
> We must have gotten different versions of the macros. Mine did not
> have an 'end' statement but I was beginning to suspect that yours
> did. That would be about the only reason for the assembler to stop
> early.
>
> I am not sure why your code would execute any case. In my version
of
> SIM without a stimulus file the value of PORTA is always 0. This
> should not execute any case and if you have placed a goto loop
> statement following endselect you should not fall into the reverse
> subroutine. The label 'loop' should be before the movwf PORTA,W
>
> An easy way to trace this code is to put a movlw 3 (or something)
> immediately after the movwf PORTA,W. This will load W with a
> matching value for one of the various cases. I would still mask
off
> the unused bits and change the select and case statements as
> discussed previously.
>
> --- In , "stephendbarnes"
> <stephendbarnes@h...> wrote:
> > Thank you. I have made a little progress. I found that the
compiler
> > was only compiling the macros.inc file and stopping there! I'm
new
> to
> > this and your comments about the .lst file made me go look at it!
> > WOW. It reported 0 program words used! Looking at the list I saw
> that
> > none of my code was present. The problem seemed to be that Karl
> > Lunt's macro file has the compiler directive "end" at the end. I
> > assume that this was causing the compiler to stop dead in its
> tracks.
> > I removed the "end" directive from the macro file and it compiled
> and
> > simulates. I do have a problem with the thing constantly going to
> the
> > first case "case 3" and ignoring the other two regardless of the
> > value W. I'll be looking forward to seeing your code. I will try
> > debugging this myself without yelling for help at every turn
(jump
> in
> > with both feet and only yell when drowning!). You have been, and
> are
> > being, an enormous help. Thanks again.
> >
> > Regards,
> > Steve
> >
> > --- In , "rtstofer" <rstofer@p...> wrote:
> > > 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