Hi David, I know using res is more comfortable, and I would like to do that, but it= doesn't work for me. I create a new project for testing it again, (MPASM project, not MPLINK) = for PIC17C756A with only one file, and the following code: ;; BEGIN CODE LIST p=3D17C756a #include ; processor specific variable definitions __CONFIG _WDT_OFF & _XT_OSC & _BODEN_ON & _MC_MODE org 0x0000 goto START org 0x8 goto START org 0x10 goto START =09 org 0x18 goto START org 0x20 goto START org 0x21 var1 res 1 var2 res 1 test1 res 1 test2 res 1 START goto START end ;; END CODE Then I compile, and I click on Window->Modify. In the list of variables, = I type var1, or test1 or whatever variables you want (from the four I res= erved), and I can't find=20 them. Maybe you noticed I was not using UDATA. If I place it just before "var1 = res 1", I get a compiler error: Error[149] E:\PRUEBA\MPLAB\PRUEBA\RES_EQU\RES_EQU.ASM 23 : Directive on= ly allowed when generating an object file Also, if you look at the device datasheet (DS30264A), page 37, there is = an example of an interrupt service routine. I copy it here: ; The addresses that are used to store the CPUSTA and WREG values must be= in the data memory ; address range of 1Ah - 1Fh. Up to 6 locations can be saved and restored= using the MOVFP ; instruction. This instruction neither affects the status bits, nor corr= upts the WREG register. ; UNBANK1 EQU 0x01A ; Address for 1st location to save UNBANK2 EQU 0x01B ; Address for 2nd location to save UNBANK3 EQU 0x01C ; Address for 3rd location to save UNBANK4 EQU 0x01D ; Address for 4th location to save UNBANK5 EQU 0x01E ; Address for 5th location to save ; (Label Not used in program) UNBANK6 EQU 0x01F ; Address for 6th location to save ; (Label Not used in program) ; : ; At Interrupt Vector Address PUSH=20 MOVFP ALUSTA, UNBANK1 ; Push ALUSTA value MOVFP BSR, UNBANK2 ; Push BSR value MOVFP WREG, UNBANK3 ; Push WREG value MOVFP PCLATH, UNBANK4 ; Push PCLATH value ; : ; Interrupt Service Routine (ISR) code ; POP=20 MOVFP UNBANK4, PCLATH ; Restore PCLATH value MOVFP UNBANK3, WREG ; Restore WREG value MOVFP UNBANK2, BSR ; Restore BSR value MOVFP UNBANK1, ALUSTA ; Restore ALUSTA value ; RETFIE ; Return from interrupt (enable interrupts) As you can see, this example uses EQU for the address of the location (UN= BANK1, for example) to save the registers, before the interrupt service r= outine code. I know using "res" is the way to work with some other devices, but with t= his device, the way seems to be working with "equ"... Carlos 25/05/01 0:22:47, David Cary escribi=F3: > >Dear Carlos Nieves =D3nega, > >Carlos Nieves =D3nega on 2001-05-24 08:56:13 AM m= entioned >>Subject: Re: [PIC]: PIC C compiler & MPLAB >... >>when I begin programming my chip (pic17c756) (in assembler). I have var= iables >coded as: >> >>var1 res 1 > >Every single one of my variable locations are defined using "res", just = like >this. > >>and they weren't shown in the list. > >It works for me. When I open the ``file register window'' and right clic= k on a >byte, I get the ``Modify'' dialog box. All of my variables are listed in= the >little drop-down ``address'' field. I modify them all the time when I'm >single-stepping through the code using MPLAB ICD. > >>The problem > >What problem ? It works fine for me. > >>was I misunderstood the assembler, >>and this assembler directive reserves a byte in program memory >>(which is >>EPROM, so you can't modify it while executing code). >>The solution was declare the variable as an address: >> >>var1 equ 0x05 (Data address 0x05) > >I like to distinguish between reserving a byte of RAM for a variable (us= ing >``res''), vs. defining a constant (using ``equ''). When I accidentally p= lace 2 >variables in the same RAM location, ``res'' gives me a nice warning tell= ing me >exactly where the problem is, but ``equ'' compiles without warning, leav= ing me >mystified when it doesn't do what I expected at runtime. > >
>screen_array   UDATA     ; Let linker allocate space for these.
>     ; backup of screen for double-buffering
>screen         res (64*12/8)
>...
>
>test_buffers   UDATA_SHR ; Let linker allocate space for this in unbanke=
d RAM.
>buffer3   res 1
>buffer2 res 1
>
>...
>
>;***** BAUD RATES *****
>;
>B9600          EQU  129       ;9600 BAUD
>B19200         EQU  64        ;19200 BAUD
>B38400         EQU  32        ;38400 BAUD
>...
>
>font_subs CODE
>
>; uses 1 stack
>; given a character in w, copy
>; the pixels of that character
>; from the ``medium_font''
>; to ``screen'' buffer
>copy_character_to_screen_buffer:
>     ; Look up starting address in table
>     addlw (0 - ' ') ; (table starts with space character)
>...
>     return
>
> >-- >David Cary > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body