Searching \ for 'beginners questions' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=beginners+questions
Search entire site for: 'beginners questions'.

Truncated match.
'beginners questions'
2000\03\30@162806 by

Hi all:
I have some basic questions. I am trying to get a stepper motor to make some
simple repeating moves. A person on the list was nice enough to share some
code with me. Anyway,here are the questions:
1. movlw 00
movwf PORTA (why does this make RA0,RA2,RA3 inputs and RA1, RA4 outputs?
wouldnt it be all inputs )

2.movlw d'10' (if  decimal 10 = binary 1010 is the rest of the w register
automatically set to 0000 so that the register looks like 00001010 or lets
say w has 11111111 in it then i say movlw d'10' ill it then be 11111010

Thanks
for any help

Steve

On Thu, 30 Mar 2000 13:27:54 -0800 Steven Rightnar
<rightnarDOMINION.LLUMC.EDU> writes:
> Hi all:
> I have some basic questions. I am trying to get a stepper motor to
> make some
> simple repeating moves. A person on the list was nice enough to
> share some
> code with me. Anyway,here are the questions:
> 1. movlw 00
>    movwf PORTA (why does this make RA0,RA2,RA3 inputs and RA1, RA4
> outputs?
> wouldnt it be all inputs )

They (sh)(w)ould be outputs if you set it to 0 (zero).
Is the chip an 16f/c84?

> 2.movlw d'10' (if  decimal 10 = binary 1010 is the rest of the w
> register
> automatically set to 0000 so that the register looks like 00001010
> or lets
> say w has 11111111 in it then i say movlw d'10' ill it then be
> 11111010

It would not be 10 if it was 11111010!!
It would be: 250

>
> Thanks
> for any help
>
> Steve

CYA!
Andrew
N1YEW
________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

Steven Rightnar wrote:
>
> Hi all:
> I have some basic questions. I am trying to get a stepper motor to make some
> simple repeating moves. A person on the list was nice enough to share some
> code with me. Anyway,here are the questions:
> 1. movlw 00
>    movwf PORTA (why does this make RA0,RA2,RA3 inputs and RA1, RA4 outputs?
> wouldnt it be all inputs )

Those two instructions write the value 'zero' to PORTA. In other words,
if all the PORTA pins were set to outputs the all the PORTA pins would
go to logic 0.

If you want to set the pins as inputs or outputs, then write to the TRIS

For example these instructions set PORTA pin RA0 as an output, and pins
RA1, RA2, RA3, RA4 as inputs.

bsf status,rp0
movlw b'00011110'
movwf TRISA
bcf status,rp0

> 2.movlw d'10' (if  decimal 10 = binary 1010 is the rest of the w register
> automatically set to 0000 so that the register looks like 00001010 or lets
> say w has 11111111 in it then i say movlw d'10' ill it then be 11111010

The PIC is an 8 bit device. If you write a value to any register,
including W, then all 8 bits are affected, not just some. So moving
d'10' to W means that W = b'00001010' or 0Ah or 0x0A or d'10'.

--
Best regards

Tony

http://www.picnpoke.com
salespicnpoke.com

I am sorry on the code I figured it must have been a typo and the line
should say movlw 0D . and thank you for the answer on the d'10' question ...
i am new the whole electronics thing and i have choosen to start very high
resulting in a steep learning curve and some embarrassing questions. Thanks

Steve
{Original Message removed}

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