Searching \ for '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: 'MPASM question'.

Truncated match.
PICList Thread
'MPASM question'
1995\01\12@080832 by crocontroller discussion list

flavicon
face
Is there a way to avoid the warnings that occur when
data in memory banks 1-3 is accessed?
Processor type is 16C57.
MPASM v.1.02

Example:

Definition:
       ORG 70H                 ; BANK3
RAMXX   RES  1

Code:
       BSF     FSR,BA1         ; BANK3
       BSF     FSR,BA2
Warning: Argument out of range: RAMDE (112).  Least significant bits used.
       CLRF    RAMXX


Thanks in advance.
Finn.


--
:) ============================================================
Finn L. Amundsen                Tlf: (+47) 73 90 36 17
Cap Computas AS                 Fax: (+47) 73 90 36 49
PO Box 3765, N-7002 TRONDHEIM, NORWAY
E-mail: spam_OUTfamTakeThisOuTspamtrh.cap-computas.no

1995\01\14@180142 by crocontroller discussion list

flavicon
face
Finn Amundsen (.....famKILLspamspam@spam@cap-computas.no) wrote:

>Is there a way to avoid the warnings that occur when data in memory
>banks 1-3 is accessed?
>Processor type is 16C57.
>
>Example:
>
>Definition:
>        ORG 70H                 ; BANK3
>RAMXX   RES  1
>
>Code:
>        BSF     FSR,BA1         ; BANK3
>        BSF     FSR,BA2
>Warning: Argument out of range: RAMDE (112).  Least significant bits
used.
>        CLRF    RAMXX

Finn:

Sure... There are a number of ways.

First, in case you don't understand what exactly is causing the warning,
here's a quick explanation:  The 16C57's 12-bit instructions are only
wide enough to hold an opcode and a 5-bit register address.  They work
fine for the 16C54, which only has 32 registers, but they can't handle
the 7-bit addresses of the 16C57's registers.  That's why the high two
bits of those register-addresses are held in the FSR bits you call BA1
and BA2.

When you equate the symbol RAMDE to address 70 (hex), then try to do a
CLRF RAMDE, the assembler sees that the address won't fit in 5 bits, so
it ignores the high two bits, assembles the instruction using the low 5
bits, and generates the warning message.  It's only a warning; your code
will work just fine.

The easiest (and, from some points of view, the worst) way to keep the
warnings from appearing is to use the assembler directive "LIST W=1",
which will keep warning messages from appearing in your .LST file.

Another way is to equate your symbols, not at their actual addresses,
but at the 5-bit equivalent of those addresses.  This is difficult to do
if you use ORG and RES to reserve space for registers; it's easy if you
use EQU.  For example:

       RAMG0   EQU     0x08            ;FIRST GLOBALLY-ACCESSIBLE REG.
       RAMG1   EQU     RAMG0+1         ;NEXT ONE.
       RAMG2   EQU     RAMG1+1         ;NEXT...
       ....
       RAM00   EQU     0x10            ;FIRST REGISTER ON PAGE 0.
       RAM01   EQU     RAM00+1         ;ETC...
       ....
       RAM10   EQU     0x30 & 0x1F     ;FIRST REGISTER ON PAGE 1.
       RAM11   EQU     RAM10+1         ;ETC...
       ....
       RAM20   EQU     0x50 & 0x1F     ;FIRST REGISTER ON PAGE 2.
       RAM21   EQU     RAM20+1         ;ETC...
       ....
       RAM30   EQU     0x70 & 0x1F     ;FIRST REGISTER ON PAGE 3.
       RAM31   EQU     RAM30+1         ;ETC...

This will assemble beautifully, and will generate no warnings when you
use the registers, but the PIC-Master emulator (and probably MPSIM,
too) will be a little confused.  This confusion manifests itself as an
inability to specify watch-window variables by name; since the emulator
thinks that RAM30 is at address 0x10, it will display 0x10's contents
for RAM30, instead of 0x70's.  This is a pretty minor thing, easily
worked around.

You can also equate your symbols to their real addresses, then do the "&
0x1F" masking in the body of your source-code.  For example:

               ORG     0x70

       RAMDE   RES     1               ;FIRST REGISTER ON PAGE 3.
       ....
               CLRF    RAMDE & 0x1F

This will generate no warnings, and PIC-Master/MPSIM will have a
slightly-easier time with it.  With the current version of MPASM, it's
easy to write macros that redefine the PIC opcodes, so the assembler can
even be made to automatically insert the "& 0x1F" for you when
necessary.

Unfortunately, when MPASM version 2.0 is released, it will not allow
redefinition of opcodes, so you'll probably want to do the bit-masking
in the EQUs or just turn off the warning-message display.

Good luck...

-Andy


--
Andrew Warren - fastfwdspamKILLspamix.netcom.com
Fast Forward Engineering, Vista, California


'MPASM question'
1995\11\18@180445 by mlk
picon face
Hello all,

       I know this question will bring a hailstorm of advice and
comments about which assembler(s) are best.  I am going to ask it
anyway.  I have been using the Parallax assembler (PASM) to generate
16C57 code.  In several instances my code has grown large enough to
utilize most of the program memory as well as the RAM in the PIC.  I have
found that it gets very confusing trying to manage all the bank switching
and all required for the 16C57.

       Does the Microchip assembler (MPASM) offer any features which
simplify this dilemma?  ie, can it be set up to automate the bank
switching from within the assembler?

Thanks for your comments,

Martin Kirk
Arizona State University
.....mlkKILLspamspam.....asu.edu
(602) 582-5718

1995\11\18@233813 by Andrew Warren

flavicon
face
Martin Kirk (EraseMEmlkspam_OUTspamTakeThisOuTASU.EDU) wrote:

> I have been using the Parallax assembler (PASM) to generate 16C57
> code. ....  I have found that it gets very confusing trying to
> manage all the bank switching and all required for the 16C57.
>
> Does the Microchip assembler (MPASM) offer any features which
> simplify this dilemma?  ie, can it be set up to automate the bank
> switching from within the assembler?

Martin:

MPASM doesn't automate the process, but its macro capability (which
Parallax's PASM lacks) does make the process a WHOLE lot easier.

-Andy
Andrew Warren - fastfwdspamspam_OUTix.netcom.com
Fast Forward Engineering, Vista, California


'MPASM Question'
1996\09\23@122039 by Philip Lalone
flavicon
face
       Is it possible to write a MPASM macro that will print a string
using: PRINT "This is the string"? The only way i've been able to get
anything like this working is writing seperate code for each string I
want to print, any theory or code would be appriciated.  I need to do this
for serial data and a LCD, which I've written code for, so all the macro
would need to do is call the serial/lcd routine with each character or a
pointer to the string.
                                       Philip Lalone
                                       Alpha-X Development

1996\09\23@125803 by Scott Dattalo

face
flavicon
face
Philip Lalone wrote:
>
>         Is it possible to write a MPASM macro that will print a string
> using: PRINT "This is the string"? The only way i've been able to get
> anything like this working is writing seperate code for each string I
> want to print, any theory or code would be appriciated.  I need to do this
> for serial data and a LCD, which I've written code for, so all the macro
> would need to do is call the serial/lcd routine with each character or a
> pointer to the string.

Philip,

I'm not sure if this is exactly what you want... But several months ago
I posted some code that allowed strings to be looked up in a table. Matthew
Rowe copied it into his "Virtual Notebook" (see the write_string function):

http://hobbes.king.ac.uk:80/matt/pic/tables.html


You will still need to supply the LCD infra-structure software. That should
be no problem since you see a new version every month or so...


Matthew has some other PIC stuff at

http://hobbes.king.ac.uk:80/matt/pic/

(Hey Matthew, are you still out there?)


Scott

1996\09\23@150621 by Martin J. Maney

flavicon
face
On Mon, 23 Sep 1996, Philip Lalone wrote:

>         Is it possible to write a MPASM macro that will print a string
> using: PRINT "This is the string"? The only way i've been able to get
> anything like this working is writing seperate code for each string I
> want to print, any theory or code would be appriciated.  I need to do this
> for serial data and a LCD, which I've written code for, so all the macro
> would need to do is call the serial/lcd routine with each character or a
> pointer to the string.

I'm not certain about the syntax, but I believe there's a built-in that
will take a string (?) and assemble a series of retlw instructions, which
suggests that you could get the macro to generate something like this:

   goto str1_end
str1:
   retlw 'T'
   retlw 'h'
   retlw 'i'
   retlw 's'
   .
   .
   .
   retlw 0
str1_end:
   movlw high(str1)
   movwf StrPtrHi
   movlw low(str1)
   call RoutineToOutputStringToWherever

Where the output routine would handle stepping the pointer and fetching
bytes until the terminating NUL was reached.  Alternately, I believe you
could make the first byte returned be a count.  In either case, the
string's (far) address is in StrPtrHi:W on entry to the output routine.

Hmmm... I may have a use for this in a project that's been simmering on
the back burner for a while.  :-)

1996\09\23@163855 by Scott Dattalo

face
flavicon
face
Martin J. Maney wrote:
>
> I'm not certain about the syntax, but I believe there's a built-in that
> will take a string (?) and assemble a series of retlw instructions....

   dt "your string", 0

will be assembled by MPASM as though if it were

   RETLW  'y'
   RETLW  'o'
   RETLW  'u'
   RETLW  'r'
     .
     .
     .
   RETLW  0

Scott

PS. Did the previous message I posted on this thread get out there? I got
confirmation from the PICLIST server, yet I also got an error from what I
believe to be a Compuserve server saying that the "mail-box" was full. I
requested this month's archive and did see my post. However, Martin's
question/response suggests that my post never made it (or maybe you didn't/
couldn't check out the web link, Martin?). At any rate, I can a) repost
the original message, or b) Post a message that has the code (so you
don't have to surf).


'mpasm question'
1996\12\21@192231 by Tony Matthews
flavicon
face
Hello
Would someone be willing to explain what I am doing wrong here This is
mpasm .lst file clipping for a 16c84?

Warning[202]: Argument out of range.  Least significant bits used.
0008 301B           00031                 MOVLW   11111b          ;value
used to initialize data direction
Message[302]: Register in operand not in bank 0.  Ensure that bank bits
are correct.
0009 0085           00032                 MOVWF   TRISA           ;set
ra <0:5> to input mode

1996\12\21@205236 by Stephen H Alsop

picon face
try this:

0008 301B           00031                 MOVLW   00011111b          ;value

I always pad out the binary to 8 chars.  Also try '00011111'b with ' '
chars either side as early versions of mpasm seemed to need this.

Also - I do not use the tris reg.  Instead use the fsr and indf reg, eg

       movlw   trisa   ;get the address of the tris reg into w
       movwf   fsr     ;store this address at the indirect setup reg

       movlw   00001111b       ;set the io bits and store them at
       movwf   indf    ;the indirect register which is pointing to trisa

This method stops having to use page 0,1 bit setups and stops compiler
messages

Happy Xmas

----- Stephen H Alsop -----
email: @spam@s.ssystemsKILLspamspameasynet.co.uk
www  : http://easyweb.easynet.co.uk/~s.ssystems
S&S Systems Ltd, Bretton Court, Manor Road, Wales Village, Sheffield
S31 8PD, England.  Tel: 01909 773399  *  Fax: 01909 773645


----------
: From: Tony Matthews <KILLspamtonyKILLspamspamMAGICNET.NET>
: To: Multiple recipients of list PICLIST <RemoveMEPICLISTTakeThisOuTspamMITVMA.MIT.EDU>
: Subject: mpasm question
: Date: 22 December 1996 00:21
:
: Hello
: Would someone be willing to explain what I am doing wrong here This is
: mpasm .lst file clipping for a 16c84?
:
: Warning[202]: Argument out of range.  Least significant bits used.
: 0008 301B           00031                 MOVLW   11111b          ;value
: used to initialize data direction
: Message[302]: Register in operand not in bank 0.  Ensure that bank bits
: are correct.
: 0009 0085           00032                 MOVWF   TRISA           ;set
: ra <0:5> to input mode

1996\12\21@212630 by Bob Blick

flavicon
face
>Warning[202]: Argument out of range.  Least significant bits used.
>0008 301B           00031                 MOVLW   11111b

It doesn't understand you are giving it a binary number. You should say:
           MOVLW   b'00011111'


>Message[302]: Register in operand not in bank 0.  Ensure that bank bits
>are correct.
>0009 0085           00032                 MOVWF   TRISA

PICs can't address registers above 7F directly, and TRISA is 85, and the
assembler is telling you it is addressing 05 or 85, it doesn't know which.
Which one depends on the setting of bit 5 of the status register (this bit
is usually referred to as "RP0").

In other words, of the eight bits you need for a register's address, you can
only specify the lower 7. The eighth bit is ignored, and RP0 is used instead.

To make sure that you are really talking to TRISA, you would need to do this:

          movlw   b'00011111' ;the direction pattern you wanted
          bsf     STATUS,5    ;set RP0 to the 80's
          movwf   TRISA       ;move w into TRISA
          bcf     STATUS,5    ;switch back to the lower bank of registers

You'll still get the "Message[302]: Register in operand not in bank 0.
Ensure that bank bits" warning, but ignore it or tell the assembler to
suppress it.

Most people will tell you that changing to register bank 1 is not needed,
since there is a perfectly good way to do just what you wanted. I'd do it, too!

          movlw   b'00011111' ;your bit pattern
          tris    5           ;5 is the address of port A

This will give you an assembler warning, but ignore it. The tris command is
still valid and you should use it whenever you want to.

Cheers, Bob

1996\12\21@223630 by Bob Blick

flavicon
face
>
>Also - I do not use the tris reg.  Instead use the fsr and indf reg, eg
>
>        movlw   trisa   ;get the address of the tris reg into w
>        movwf   fsr     ;store this address at the indirect setup reg
>
>        movlw   00001111b       ;set the io bits and store them at
>        movwf   indf    ;the indirect register which is pointing to trisa
>
>This method stops having to use page 0,1 bit setups and stops compiler
>messages


That's very clever! I always assumed that register addresses would be formed
the  same way when using fsr. (taking the top bit from RP0)


'mpasm question'
1997\08\13@103133 by Ooijen,Wouter van
picon face
Is it possible in MPASM to create a #define-macro which translates to
- multiple lines of 'code', among which
- a start-of-macro-definition (the "label MACRO parameter,..." type of
macro) line

I want to create
  #procedure(procname)
and
  #endproc
macros which (among other things) store the intervening lines as a macro
definition.

regards,
Wouter.

1997\08\13@185105 by Ravindra Divekar

picon face
yes it is easy:
the macros can even take parameters.

for e.g. the following macro simulates
an 8051 instruction (compare and jump if not equal)
the macro begins with a "macro" declaration and ends with
a "endm" statement. if the "reg" value is not equal
to the constant the program branches to "label".


cjne macro reg,constant,label
       movlw   constant
       subwf   reg,w
       btfss   status,zero
       goto    label

       endm



{Quote hidden}

1997\08\13@213953 by David Bramham

picon face
Thank you for the info , I will see how things pan out
Regards- David

At 03:22 PM 13/08/97 -0700, you wrote:
{Quote hidden}

1997\08\14@030706 by Ooijen,Wouter van

picon face
>yes it is easy:
>the macros can even take parameters.
>.....

That is not what I meant: I want a #define-style macro to translate to
mutiple lines,
one of which would be the beginning (or end) of a label-MACRO-args style
macro.

something like:

#define procedure(name) \
name macro

#define endproc(name) \
endm

> regards,
> Wouter.
>
>

1997\08\14@031957 by Andrew Warren

face
flavicon
face
Ooijen,Wouter van <Ooijen,Wouter van <spamBeGonePICLISTspamBeGonespamMITVMA.MIT.EDU>> wrote:

> I want a #define-style macro to translate to mutiple lines, one of
> which would be the beginning (or end) of a label-MACRO-args style
> macro.
>
> something like:
>
> #define procedure(name) \
> name macro
>
> #define endproc(name) \
>  endm

Wouter:

I'm not sure that I understand what you want... But if you just want
to type

   procedure (name)

and have MPASM translate it to

   name macro

then you can do it with the following #define:

   #define procedure(name) ((name) macro)

The corresponding #define for "endproc" is simply:

   #define endproc(name) (endm)

Depending upon the way you indent your "procedure" and "endproc"
invocations, you may need to add the following to the top of your
source file:

   LIST FIXED=0

I hope this helps... But, again, I really don't think I understood
your question.

-Andy

=== Andrew Warren - TakeThisOuTfastfwdEraseMEspamspam_OUTix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

=== For PICLIST help (including "unsubscribe" instructions),
=== put the single word "help" in the body of a message and
=== send it to: RemoveMElistservspamTakeThisOuTmitvma.mit.edu

1997\08\14@034902 by Ooijen,Wouter van

picon face
I tried andrew's suggestion:
  #define open(x) ((x) macro)
but that does not work (in mpasm V01.50 from MPLAB).
"open(a)" seems to be translated to "(a) macro" or "((a) macro)",
which is not accepted by mpasm as the start of a macro definition.

BTW, I can start a macro open (see below), but I can not end a macro
with close!
  #define open(name)name macro
  #define close endm
  ...
  open(my_macro)
  ; macro body
  close
Anyone understands why?

To rephrase the second part of my question: can a #define macro
translate
to multiple lines?

regards,
Wouter.

{Quote hidden}

1997\08\14@042430 by Andrew Warren

face
flavicon
face
Ooijen,Wouter van <Ooijen,Wouter van <EraseMEPICLISTspamspamspamBeGoneMITVMA.MIT.EDU>> wrote:

> I tried andrew's suggestion:
>    #define open(x) ((x) macro)
> but that does not work (in mpasm V01.50 from MPLAB).
> "open(a)" seems to be translated to "(a) macro" or "((a) macro)",
> which is not accepted by mpasm as the start of a macro definition.

   Whoops... Sorry about that, Wouter; I wasn't thinking.

> BTW, I can start a macro open (see below), but I can not end a macro
> with close!
>    #define open(name)name macro
>    #define close endm
>    ...
>    open(my_macro)
>    ; macro body
>    close
> Anyone understands why?

   Yeah... Now that I've actually tried to do what I said you could
   do, I see that it's not possible; MPASM doesn't like anything to
   be #defined to "endm".

   Sorry for wasting your time.

> To rephrase the second part of my question: can a #define macro
> translate to multiple lines?

   No.

   -Andy

=== Andrew Warren - RemoveMEfastfwdKILLspamspamix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

=== For PICLIST help (including "unsubscribe" instructions),
=== put the single word "help" in the body of a message and
=== send it to: listservSTOPspamspamspam_OUTmitvma.mit.edu


'MPASM Question'
2000\02\28@134449 by smerchock, Steve
flavicon
face
part 0 1258 bytes
<P><FONT SIZE=2>Friends,</FONT>
</P>

<P><FONT SIZE=2>I came across some code that has this in it:</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>movlw&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (high(TEXTSTART))</FONT>
</P>

<P><FONT SIZE=2>Can somebody plese explain to me what this means.</FONT>
<BR><FONT SIZE=2>I would appreciate it very much.</FONT>
<BR><FONT SIZE=2>Thank you in advance!!</FONT>
</P>

<P><FONT SIZE=2>Best regards,</FONT>
<BR><FONT SIZE=2>Steve</FONT>
</P>
<BR>

<P><FONT SIZE=2>Steven Kosmerchock</FONT>
<BR><FONT SIZE=2>Father/Student/Engineering Technician</FONT>
<BR><FONT SIZE=2>http://www.geocities.com/researchtriangle/lab/6584 </FONT>
</P>

<P><FONT SIZE=2>&quot;Great spirits have always encountered violent </FONT>
<BR><FONT SIZE=2>oppposition from mediocre minds.&quot;--A.Einstein</FONT>
</P>

</BODY>
</HTML>
</x-html>

2000\02\28@135312 by Andrew Kunz

flavicon
face
part 0 1253 bytes content-type:text/html;







"Kosmerchock, Steve" <spamBeGoneSteve.KosmerchockSTOPspamspamEraseMERFSWORLD.COM> on 02/28/2000 01:45:11 PM

Please respond to pic microcontroller discussion list <KILLspamPICLISTspamBeGonespamMITVMA.MIT.EDU>








To:      EraseMEPICLISTspamEraseMEMITVMA.MIT.EDU

cc:      (bcc: Andrew Kunz/TDI_NOTES)



Subject: MPASM Question




Steve,

It means that the value of TEXTSTART doesn't fit in 8 bits, and that you want to
get the portion of the value in the high byte (bits 15-8) into the W register.
This is a common way of breaking a 16-bit value into two 8-bit chunks, so it can
be manipulated by an 8-bit processor.

Andy




Friends,

I came across some code that has this in it:

       movlw           (high(TEXTSTART))

Can somebody plese explain to me what this means.
I would appreciate it very much.
Thank you in advance!!

Best regards,
Steve


Steven Kosmerchock
Father/Student/Engineering Technician
http://www.geocities.com/researchtriangle/lab/6584

"Great spirits have always encountered violent
oppposition from mediocre minds."--A.Einstein


Content-type: text/html;
       name="att1.htm"
Content-Disposition: attachment; filename="att1.htm"
Content-Description: Internet HTML

Attachment converted: birth:att1.htm (TEXT/MSIE) (00006858)

2000\02\28@181152 by Tony Nixon

flavicon
picon face
> "Kosmerchock, Steve" wrote:
>
> Friends,
>
> I came across some code that has this in it:
>
>         movlw           (high(TEXTSTART))
>
> Can somebody plese explain to me what this means.


Hi Steve,

I have been using this technique for extracting a label address for code
usage.

eg

 movlw high(CodeRun)
 movwf eeadrh
 movlw low(CodeRun)
 movwf eeadrl

 . . . .


CodeRun
 ; user code starts here



--
Best regards

Tony

http://www.picnpoke.com
@spam@sales@spam@spamspam_OUTpicnpoke.com

2000\02\28@182854 by smerchock, Steve

flavicon
face
part 0 3127 bytes
<P><FONT SIZE=2>Tony,</FONT>
</P>

<P><FONT SIZE=2>Thank you very much!!!</FONT>
<BR><FONT SIZE=2>Between you and the explanation I got</FONT>
<BR><FONT SIZE=2>from Andy Kunz,...... I understand!!</FONT>
<BR><FONT SIZE=2>Thank you both very much!!!!</FONT>
</P>

<P><FONT SIZE=2>Best regards,</FONT>
<BR><FONT SIZE=2>Steve</FONT>
</P>

<P><FONT SIZE=2>{Original Message removed}

2000\02\29@100658 by Don Hyde

flavicon
face
part 0 2664 bytes

<TITLE>MPASM Question</TITLE>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY>
<DIV><SPAN class=840360315-29022000><FONT color=#0000ff face=Arial size=2>PIC
processors process data in 8-bit bytes.&nbsp; The physical memory address
represented by a label in your code is more than 8 bits, since PIC's have more
than 256 ROM locations.&nbsp; So, in order to break code addresses into 8-bit
chunks that can be processed by a PIC, the assembler provides high and low
operators which instruct the assembler to use the high or low 8 bits of the
memory address.&nbsp; These operators become essential when dealing with memory
pages and when coding case statements.</FONT></SPAN></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">
   <DIV align=left class=OutlookMessageHeader DIR = LTR><FONT face=Tahoma
   size=2>{Original Message removed}

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