flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > PIC assembly IO help

Thread Post new topic Reply to topic

Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 16 Jan 2011, 01:44
My objective is to light an LED. So far, I have the circuit ready and the program *almost* working. That's what I need help with. I want to set RA1 high, but while executing the following code, I tested all pins(in case I messed up on the numbering/positioning) with a multimeter, and none of the pins, other than Vdd and Vss, registered.

Is there a problem in my code? I noticed that when ran in a simulator, PORTA(0x05) never changes value, I assumed this was normal since it is not average memory, but it could also be the effect of a bug.

STATUS equ 03h
PORTA        equ 05h
PORTB        equ 06h
TRISA        equ 85h
TRISB        equ 86h

    call    init
        movlw   02h
 xorwf   PORTA,01h
    movlw   0ffh
        call    delay
       call    delay
       goto    main

; switch to bank 1
  bsf     STATUS,05h
; clear bit 1 to set RA1 to out
       bcf     TRISA,01h
; switch back
  bcf     STATUS,05h

     movwf   20h
 decfsz  20h,01h
     goto    wait
Post 16 Jan 2011, 01:44
View user's profile Send private message Reply with quote

Joined: 20 Feb 2006
Posts: 4325
Location: Now
edfed 20 Feb 2011, 10:19
can the PORTA(5) be configured as you want? if you refer to the datasheet, maybe you will find a little line saying: porta bit 5 cannot be configured as output... something like that.

it is the case for the pic12F675, where some pin of GPIO that cannot be configured as input, a read on this pin will always be 1.
Post 20 Feb 2011, 10:19
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.