Searching \ for 'another MPASM question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/language/index.htm?key=asm
Search entire site for: 'another MPASM question'.

Truncated match.
PICList Thread
'another MPASM question'
2000\02\28@184754 by Alice Campbell

flavicon
face
Is there a way to load a file instead of a literal using a table:

for example
a_table
       movwf   pcl
       return-with-in-work  buffer1
       return-with-in-work  buffer2
       return-with-in-work  buffer3
       return-with-in-work  buffer4

thanks,
alice

2000\02\28@201554 by Jason Harper

picon face
> Is there a way to load a file instead of a literal using a table:
>
> for example
> a_table
>         movwf   pcl
>         return-with-in-work  buffer1
>         return-with-in-work  buffer2
>         return-with-in-work  buffer3
>         return-with-in-work  buffer4

There is no PIC instruction that both loads W with a register and returns.
However, you could do these with two separate instructions, doubling your
index into the table since each entry is now two words:

       movwf temp
       addwf temp,w    ; w = w * 2
       addwf pcl,f
       movf buffer1,w
       return
       movf buffer2,w
       return
       movf buffer3,w
       return
       movf buffer4,w
       return

Note that this won't work on 12-bit core PICs, which lack a plain RETURN
instruction.  Also, this is quite inefficient assuming that the various
registers that you're trying to load are in sequential addresses: that's
exactly what the FSR register is for.  Try this:

       addlw buffer1   ; w = index + address of buffer1
       movwf fsr
       movf indf,w     ; w = value at address in FSR

       Jason Harper

2000\02\28@201557 by Tony Nixon

flavicon
picon face
Alice Campbell wrote:
>
> Is there a way to load a file instead of a literal using a table:
>
> for example
> a_table
>         movwf   pcl
>         return-with-in-work  buffer1
>         return-with-in-work  buffer2
>         return-with-in-work  buffer3
>         return-with-in-work  buffer4
>
> thanks,
> alice

Maybe this....

       movf Offset,w
       call RAM_AD
       movwf fsr
       movf indirect,w
       ......

RAM_AD
       addwf pcl
       retlw RAM_AD_1
       retlw RAM_AD_2
       retlw RAM_AD_3
       retlw RAM_AD_4



--
Best regards

Tony

http://www.picnpoke.com
spam_OUTsalesTakeThisOuTspampicnpoke.com

2000\02\29@010724 by Regulus Berdin

picon face
Or if RAM_AD_X are contigous:

       movwf   fsr
       movlw   RAM_AD_1
       addwf   fsr,f
       movf    indf,w
       .
       .
       .

Best regards,
Reggie


Tony Nixon wrote:
{Quote hidden}


'another MPASM question'
2000\03\01@122340 by Alice Campbell
flavicon
face
I have tried this.  My code has sprouted bank select errors like
dandelions.  I think there is something I dont understand about the
way the memory is organized.  If I set:

       cblock 0x10
       buf1    :1
       buf2    :2
       buf3    :3
       etc             :4
       endc
and then call for the contents of buf2,
and then say:

> Or if RAM_AD_X are contigous:
>

               movlw .2                ;choose the second buffer
>         movwf   fsr
>         movlw   RAM_AD_1
               movlw   0x11
>         addwf   fsr,f
>         movf    indf,w
>

then shouldnt the contents of indf be the 2 from buf2???
all it does is yell at me about being in the wrong bank.  im still in
bank0, am i not??

alice
{Quote hidden}

2000\03\01@142559 by Alice Campbell

flavicon
face
Hi tony,

im still working on the indf question, still in confusion but it will
work out.  However, i have another, different question:

what is the rom loader discussion about?
whats a rom loader?
sorry for my ignorance, but its probably reversible.

alice

{Quote hidden}

2000\03\01@144837 by M. Adam Davis

flavicon
face
The rom loader is a method of re-programming the PIC without a programmer and in
circuit.

The newer flash chips (16f87x) have the ability to write to their own program
memory.  Other flash chips (16f84, etc) could only write to a special data
memory.

Since these newer chips can write their own program memory, then we can install
a tiny program in the chip which will act as a loader for the program.  In other
words, connect the chip to a computer and send the new program code straight
over.  No programming voltages, no special sockets, and easy to accomplish
remotely (over telephone, radio, internet, etc) so you don't have to be
physically present to re-program a chip.

Generally the setup is as follows:

A pin is set apart such that when the PIC powers up, it checks this pin.  If the
pin is in a pre-defined state (low) it starts the user program (the program
which was last stored in the chip) if the pin is in the other state (high), it
starts the bootloader code, which accepts commands to read and program the user
program area of the chip.  Once programming is complete the bootloader either
resets the chip, or starts the user program.  One could also provide options
inside the user program which will call the bootloader so you don't have to be
at the hardware setting/clearing pins.

An example of where this might be useful:
Datalogging equipment.  Instead of having a chip which has set functions (which
really means set limitations) you can use, you can reprogram the entire chip to
do some data processing as well as logging.  You could update the program as
your research continues and you discover that your data isn't complete, and you
need to change some parameters remotely.

Home automation, process control industry, anywhere where functionality might
need to be upgraded.

Rapid prototyping, making devices which need to be deployed yesterday with a few
basic functions, but need to provide more complex functions ASAP.  (or following
software company models of releasing buggy product, and sending out service
packs, er, I mean software upgrades... ;-)

Development environments.  I'm doing home automation right now, but I realize
that I want to change the program as I go.  I don't want to uninstall and
reprogram my lightswitches everytime I change the program, so I make my bootload
operate with a basic network protocol.  When the next big thing comes along
(CAN, LON, etc) (as long as I plan my hardware ahead of time) I can reprogram
all of my nodes to use and interface with the new protocol.

-Adam

Alice Campbell wrote:
> what is the rom loader discussion about?
> whats a rom loader?
> sorry for my ignorance, but its probably reversible.
>
> alice

2000\03\01@171004 by Tony Nixon

flavicon
picon face
Alice Campbell wrote:
>
> I have tried this.  My code has sprouted bank select errors like
> dandelions.  I think there is something I dont understand about the
> way the memory is organized.  If I set:
>
>         cblock 0x10
>         buf1    :1
>         buf2    :2
>         buf3    :3
>         etc             :4
>         endc


I haven't tried this but

cblock 0x10    ; check address >= lowest ram location for chosen chip.
 buffer: X    ; X = number of bytes needed for buffer
endc


To access buffer through indirect addressing
Eg.
10 bytes in buffer block starting at RAM address 0x10
Offset can vary from 0 to 9

       movf offset,w   ; W = 0 - 9
       addlw buffer    ; W = 0x10 + (0 - 9)
       movwf fsr       ; set indirect address
       movf indf,w     ; W = data from buffer



M. Adam Davis gave a pretty good description of a boot loader.

Learning changes ignorance to knowledge. No appologies needed :-)

I hope this helps.


--
Best regards

Tony

http://www.picnpoke.com
EraseMEsalesspam_OUTspamTakeThisOuTpicnpoke.com

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...