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.

Proteus ISIS Simulation Problem

Status
Not open for further replies.

TipTip

New Member
Hello Fellows,

Hope everyone here is in great health.
I need your help fellows, I have been asked the following Question:


"Write a program that ANDs the input logic levels available at the pins RB0, RB1,
RB2,RB3, and outputs the result to pin RA0"


I have done the coding to it using MPLAB IDE:

Code:
		processor 16f84A 
			include    <p16f84A.inc> 
			__config  _HS_OSC & _WDT_OFF & _PWRTE_ON
				
			ORG 	H'00'
			BSF		STATUS,RP0
			MOVLW	H'0F'
			MOVWF	TRISB
			MOVLW	H'00'
			MOVWF	TRISA
			BCF		STATUS, RP0
DOAGAIN		BTFSS	PORTB,0
			CALL	OUTPUT0
			BTFSS	PORTB,1
			CALL 	OUTPUT0
			BTFSS	PORTB,2
			CALL	OUTPUT0
			BTFSS	PORTB,3
			CALL	OUTPUT0
			CALL	OUTPUT1
			GOTO	DOAGAIN


OUTPUT0		MOVLW	H'00'	
			MOVWF	PORTA
			RETURN		
OUTPUT1		MOVLW	H'01'	
			MOVWF	PORTA
			RETURN		
			end




. And after compiling the coding, I have added the .hex file created to the circuit I simulated, but the problem is that the logic is not workig, i.e. if I make inputs RB0 to RB3 ANDed value is zero, the LED connected to the RA0 output lights up.

I have attached the .hex file, .asm file.
As for the proteus ISIS .DSN file it is here:

**broken link removed**

I hope I could find anyones help.

Thanks a lot and looking forward for your help

TipTip
 

Attachments

  • CODE3.asm
    522 bytes · Views: 163
  • LAb3HW.hex
    195 bytes · Views: 142
When your bit test calls an OUTPUT0 it returns to the next statement
it shouldnt do that, otherwise it will always show OUTPUT1.

that should be obvious when stepping through it.
 
Tubos,

Thanks a lot. You made my day.
I hope you a nice and entertaining year.
+ rep to you too


TipTip
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top