AquaticTechTank.net

A forum dedicated to design and program aquatic tanks
It is currently Thu Sep 21, 2017 7:47 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Apr 14, 2017 10:51 pm 
Offline

Joined: Thu Apr 13, 2017 9:44 pm
Posts: 1
Hello:

I have the following code to send a 1 though PORTB[0] when PORTA[2] = 1; the problem is that the value b'000001000' is never stored in PORTA, i don't know why and i use the variable "aux" to verufy this, when i move the value from PORTA to aux it comes as 00 when i already supposedly have given PORTA the value of b'00000100', any idea of what is going wrong? Thank you

PS: i'm using MPLABX IDE v 3.55, running on windows 10
The datasheet of PIC16F84A:http://www.kynix.com/uploadfiles/pdf65976/PIC16F84A-042fP_607407.pdf
Code:
list p=16f84a ;Tipo de dispositivo
;Zona de etiquetas
STATUS EQU 0x03
PORTA EQU 0x05
PORTB EQU 0x06
TRISB EQU 0x86
TRISA EQU 0x85
RP0 EQU 0x05
aux equ 0x41
ORG 0
Goto INICIO
ORG 5

INICIO
bsf STATUS, RP0 ; Goes to Bank1
clrf PORTB ; PORTB as output
movlw b'00000100' ; Bit 2 of A as input
movwf PORTA
bcf STATUS, RP0 ; goes to bank0
clrf PORTB ; clears portB
movlw .5
movwf aux
movf PORTA, 0
movwf aux
BUCLE
btfss aux, 2 ; if (RA2 = 1 )
goto TOFF ; => turn off
goto TON ; [] turn on
TON
bsf PORTB, 0 ; RB0 = 1
goto BUCLE
TOFF
bcf PORTB, 0 ; RB0 = 0
movlw .4 ; Bit 2 of A as input
movwf PORTA
goto BUCLE

END


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Copyright 2noodles LLC 2012