Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

need help with assembley code plz help

Status
Not open for further replies.

mail866

New Member
Modifiy the following the assembley program so 1 pin of the PORTA as input=5v or 0v and other 1 pin of PORTA as output= 5v or ov. i am stuck in it. i do not what to change here for new modifications for PIC16X8x?





;*****Set
up the
Constants****




STATUS
equ
03h ;Address
of the
STATUS
register


TRISA

equ
85h ;Address
of the
tristate
register
for port
A


PORTA
equ
05h ;Address
of Port
A


COUNT1
equ
08h ;First
counter
for our
delay
loops


COUNT2

equ
09h ;Second
counter
for our
delay
loops




;****Set
up the
port****




bsf STATUS,5
;Switch
to Bank
1


movlw
00h ;Set
the Port
A pins


movwf
TRISA ;to
output.


bcf STATUS,5
;Switch
back to
Bank 0



;****Turn
the LED
on****




Start
movlw 02h ;Turn
the LED
on by
first
putting
it


movwf PORTA
;into
the w
register
and then
on the
port



;****Add
a delay






call

Delay



;****Delay
finished,
now turn
the LED
off****




movlw
00h ;Turn
the LED
off by
first
putting
it


movwf
PORTA
;into
the w
register
and then
on the
port



;****Add
another
delay****



call

Delay



;****Now
go back
to the
start of
the
program



goto
Start

;go back
to Start
and turn
LED on
again



;****Here
is our
Subroutine




Delay




Loop1 decfsz COUNT1,1
;This
second
loop
keeps
the LED

goto

Loop1
;turned
off long
enough
for us
to

decfsz
COUNT2,1
;see
it
turned
off

goto
Loop1 ;


return



;****End
of the
program****




end ;Needed
by some
compilers,
and also

;just
in case
we miss
the goto
instruction.
 
Firstly the formatting of your code is not helping people trying to read it..

To make another port pin of your micro flash, what is wrong with changing the line
movlw 02h ;Turn the LED on by first putting it
movwf PORTA ;into the w register and then on the port

to

movlw 01h ;Turn the LED on by first putting it
movwf PORTA ;into the w register and then on the port

To switch on bit 0 instead of bit 1 (I have changed the 'movlw 02h' statement)

This will flash another pin - I think this is what you are asking for
 
It took longer for me to reformat the code than it did to understand the problem

hi EW,
Pommie aka Mike wrote and posted a neat little 'CodeTidy2' program. ideal for a quick reformat of posted code.

I hope Mike will repost this program..:)
 
But, it still wouldn't fix that mess above. I'll tidy it up and repost it as it is one of the things I use lots.

Actually, why not post the old one. See attachment. Just unzip it and run setup.

Instructions in this thread.

Mike.
 

Attachments

  • Setup.zip
    1.4 MB · Views: 96
But, it still wouldn't fix that mess above. I'll tidy it up and repost it as it is one of the things I use lots.

Actually, why not post the old one. See attachment. Just unzip it and run setup.

Instructions in this thread.

Mike.

hi Mike,
I couldn't find it on the Forum and I was not 100% sure the copy I have is current.:eek:

The old copy I have got does the job very nicely.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top