Searching \ for 'More Newbie Questions' 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/index.htm?key=more+newbie+questions
Search entire site for: 'More Newbie Questions'.

Truncated match.
PICList Thread
'More Newbie Questions'
1995\10\29@000629 by Ben L Wirz

flavicon
face
Hello everyone, ready for my third set of basic questions?  I want to
thank everyone for ther help in my PIC education.  I appreciate it,
especially for not being riducled for basic questions.

1)  What does two's complement in nature mean when used to describe
arthmetic computations in the ALU.

2)  I am very confused about the format for the ASCII file to be
assembled by MPASM.  In the MPASM manual, it says labels are in column 1,
mnemonics in 2, .....  But when I looked in the Embedded Control
Handbook, there listing have what I assume is a line nuber, 1,2,3,... at
the being of each line.  It then list another hex number and then it uses
the MPASM manual format.  What is the correct format?

3)  How does everyone set up their columns in a text editor.  I was
considering using windows notepad and a tab between each column.  What
the criteria for a column?

4)  It would be nice if there was a program that sets up the columns and
at least check for correct syntax as you type the code in.  Does such a
program exist?

5)  Can I download the Picmaster software and use it with another
programer?  Is it worth the trouble?

Thanks,
Ben

1995\10\29@003613 by Mike Keitz

flavicon
face
>Hello everyone, ready for my third set of basic questions?  I want to
>thank everyone for ther help in my PIC education.  I appreciate it,
>especially for not being riducled for basic questions.

These are relevant questions.  Anything to other than constant discussion
about various programmers is probably of use to someone.

>1)  What does two's complement in nature mean when used to describe
>arthmetic computations in the ALU.

Two's complement is a way of representing negative binary integers.  The
high bit of the number is the sign, if 1 the number is negative, 0 it is
positive.  Positve numbers are represented in simple binary, negative ones
are, well, in two's complement.  A number can be negated by complementing
all the bits, then adding one.  For example, with 8 bit two's complement,
some numbers are represented:

Decimal Hex
0       00
1       01
127     7F  (largest positive number)
-128    80  (largest negative number)
-127    81
-2      FE
-1      FF

The range of 16-bit two's complement numbers is from -32768 to +32767.  Many
high-level languages offer this type of variable.

The reason for this system is that the ordinary binary 'add' operation will
work properly on a mixture of positive or negative numbers.  A subtraction
can be done by two's complementing the number to be subtracted, then adding.
This is how the SUBWF instruction in the PIC works, though the complement is
invisible and it works in one instruction cycle.  Also note the COMF
instruction only does the first step in the two's complement, to complete it
use an INCF next.  Or subtract the number to be complemented from 0.
Multiple precision is a little more complicated.

>
>2)  I am very confused about the format for the ASCII file to be
>assembled by MPASM.  In the MPASM manual, it says labels are in column 1,
>mnemonics in 2, .....  But when I looked in the Embedded Control
>Handbook, there listing have what I assume is a line nuber, 1,2,3,... at
>the being of each line.  It then list another hex number and then it uses
>the MPASM manual format.  What is the correct format?
>
The files printed in the books are .LST files, which are generated by the
assembler from the .ASM file.  The added columns show the line number,
location, and hex code of each line assembled.  Usually these files are only
used for troubleshooting or finding errors.  The *input* file to the
assembler is the only one you need to edit.  In general MPASM is quite
forgiving of the input format.  Any white space, either spaces or tabs, can
seperate the columns.

>3)  How does everyone set up their columns in a text editor.  I was
>considering using windows notepad and a tab between each column.  What
>the criteria for a column?

See above.  DOS-compatible tabs, spaced every 8 colums, make the file a
little more portable.  But not much.  Fortunately the assembler will still
understand your file even if it looks terrible.

>4)  It would be nice if there was a program that sets up the columns and
>at least check for correct syntax as you type the code in.  Does such a
>program exist?

Not that I'm aware of.  When you MPASM the file, it will tell you what lines
were out of order and approximately what the problem was.  When an error
occurs, an extra line is added to the .LST file directly below the error
location.  An editor that lets you examine the .LST file while editing the
.ASM file in another window is very useful.

>5)  Can I download the Picmaster software and use it with another
>programer?  Is it worth the trouble?

No.  The PICSTART and PICMASTER are controlled by the serial port using a
high-level (proprietary) protocol.  The other programmers use direct
hardware links to the PIC and must be controlled with their respective software.

-Mike

1995\10\29@024341 by Lee Jones

flavicon
face
On Sun, 29 Oct 1995 00:03:53 -0500, Ben L Wirz wrote:

> 1)  What does two's complement in nature mean when used to describe
> arthmetic computations in the ALU.

Mike Keitz described this already.  But further background might
help your understanding.  Besides twos-complement representation,
there's ones-complement for signed binary numbers.

Ones-complement still reserves the high order bit to represent the
sign; 0 for positive and 1 for negative.  The rest of the bits are
the value.  Positive ones are in simple binary.  Negative numbers
are represented as the binary value with all bits toggled to their
opposite state (i.e. complemented).  And it's nicely symmetrical
around zero (same possible number of positive and negative values).

Maybe examples will make this clearer.  For an 8 bit word:

        00 hex =   0 decimal
        01     =   1
        02     =   2
        *          *
        7E     =  126
        7F     =  127
       080     = -127
       081     = -126
        *          *
       0FE     =  -1
       0FF     =  -0

Nagging problem with ones-complement is the existence of 2 zeros.
Positive zero is all bits set to 0.  Negative zero is all bits set
to 1.  This complicates the arithmetic logic unit (ALU) hardware.
I believe that ones-complement was used in some old computers.

Twos-complement representation is normally used now since it only
has 1 zero (at the expense of being non-symmetrical given that it
allows 1 more negative value than it can have positive values).

                                               Lee

-------------------------------------------------------------------
Jones Computer Communications             spam_OUTleeTakeThisOuTspamfrumble.claremont.edu
509 Black Hills Dr, Claremont, CA 91711         voice: 909-621-9008
-------------------------------------------------------------------

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