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.

PortA can not be written

Status
Not open for further replies.

spotter-b

New Member
list p=16F628A
#include <p16F628A.inc>
errorlevel -302, -207
__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_ON & _BOREN_ON & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _XT_OSC
;...................

#define status STATUS
#define Banco0 bcf status,5
#define Banco1 bsf status,5
#define portb PORTB
#define Trisb TRISB
#define trisb TRISB
#define Trisa TRISA
#define porta PORTA
#define trisa TRISA

;....................
goto prueba_de_encendido

prueba_de_encendido: Banco1
clrf trisa ;porta salida
clrf trisb
Banco0
movlw 0xff
movwf portb ;encendido de todos los leds
movlw 0x01
movwf porta ;encendido de A0
movwf portb
bsf PORTA,0
bsf porta,1
bcf portb,0
bsf portb,1
movlw 0xff
movwf porta
nop
stop
end
...........................................
¿¿Why is the port A can not be written??...and meanwhile the same instruction
can write port B perfectly???
clrf trisa;..... moves a 20H instead a "0"
movwf to porta;.... moves nothing to porta as the wreg have a "1".
bsf PORTA,0;...........does not work
bsf porta,1;.............does not work
trisa is 0 so the information should go trough!!!
;.......................................
Thanks to all for your time!!!
spotter-b
 
Thanks! Nigel!!
I know your tutorial but I don´t see which one o where is established condition to disable the comparator..
I thought that if VRCON and CMCON are "00H", the comparators and voltafe reference functions where off..
 
All my tutorials disable the comparators, as none use them - the line is commented "make it like a 16F84".

Code:
	org	0x0000			;org sets the origin, 0x0000 for the 16F628,
					;this is where the program starts running	
	movlw	0x07
	movwf	CMCON			;turn comparators off (make it like a 16F84)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top