Jump to content

So, I can't seem to figure why my program doesn't work. It should receive a 4bit binarial number by portA and display it through portB coded for a 7 segment display, using RA4 and RA6 to turn the displays on, but I only get both displays on and 88 getting display, and a short If I put any bit on

TP6.asm

Case: NZXT phantom CPU:I5-4460 GPU:MSI-GTX1070 Gaming X RAM:2x4Gb-DDR3-HyperX fury MOBO:Asus Z97-P HDD:Toshiba 1Tb 7200rpm PSU:Sentey650W

Link to comment
https://linustechtips.com/topic/654982-assembler-help/
Share on other sites

Link to post
Share on other sites

In "inicio":

	movlw	h'01'     
	movwf	TRISA

Moves literal hex value 01 to TRISA. In binary this is 00000001, thus this makes RA0 a input and all other PORTA pins outputs. This is probably not what you want if you need to receive a 4 bit value on PORTA ?

 

In "principal":

movlw	PORTA
movwf	temp

MOVLW means "Move literal to W" thus the above instruction moves the literal value "PORTA" (h'05' - the memory address of PORTA) to W, not the contents of PORTA. To copy the contents of PORTA to W use:

MOVF PORTA, W
MOVWF TEMP

 

 

Link to comment
https://linustechtips.com/topic/654982-assembler-help/#findComment-8425022
Share on other sites

Link to post
Share on other sites

21 hours ago, Unimportant said:

In "inicio":


	movlw	h'01'     
	movwf	TRISA

Moves literal hex value 01 to TRISA. In binary this is 00000001, thus this makes RA0 a input and all other PORTA pins outputs. This is probably not what you want if you need to receive a 4 bit value on PORTA ?

 

In "principal":


movlw	PORTA
movwf	temp

MOVLW means "Move literal to W" thus the above instruction moves the literal value "PORTA" (h'05' - the memory address of PORTA) to W, not the contents of PORTA. To copy the contents of PORTA to W use:


MOVF PORTA, W
MOVWF TEMP

 

 

Thanks dude! I'll test it tomorrow and advice you!

Case: NZXT phantom CPU:I5-4460 GPU:MSI-GTX1070 Gaming X RAM:2x4Gb-DDR3-HyperX fury MOBO:Asus Z97-P HDD:Toshiba 1Tb 7200rpm PSU:Sentey650W

Link to comment
https://linustechtips.com/topic/654982-assembler-help/#findComment-8472800
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×