Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] need help coding pic16f84a scanning of switches

Status
Not open for further replies.

ernestclydeachua

Junior Member level 1
Joined
Aug 5, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,380
hello i need help coding
i want to produce an out put like this
POW.gif

ive done some programming

and changed the ports it runs on simulation but wont run in the circuit it cause my LEDs to turn off and on when i energize a single switch

here the code
Code:
;RB0 controls RB7 and RA0 
;RB0=0 then RB4 and RA0=0, else it will be 1 when RB0=1
;RB1 controls RB5 and RA1
;RB2 controls RB6 and RA2
;RB3 controls RB7 and RA3
 
	list      p=16F84A            ; list directive to define processor
	#include <p16F84A.inc>        ; processor specific variable definitions
	errorlevel -302, -207	
 
	__config _CP_OFF &_XT_OSC & _PWRTE_ON & _WDT_OFF
 
cntr1	equ	h'21'
cntr2	equ	h'22'
bfr1	equ 	23h
 
	ORG     0x000             ; processor reset vector
  	goto    main              ; go to beginning of program
 
	ORG     0x004             ; interrupt vector location
	nop
	retfie                    ; return from interrupt
 
main:
	bsf	STATUS,RP0
	movlw	b'00000000'
	movwf	TRISA
	movlw	b'00001111'
	movwf	TRISB
	bcf	STATUS,RP0
 
newloop:
	movf PORTB,W
	movwf bfr1
	movf bfr1,W
	movwf PORTA
	rlf bfr1,F
	rlf bfr1,F
	rlf bfr1,F
	rlf bfr1,F
	movf bfr1,W
	movwf PORTB
	goto newloop	
 
	end
 

Hi,

Your code seems to work ok.

Is you circuit like mine below ?
 

Attachments

  • ScreenShot001.jpg
    ScreenShot001.jpg
    111 KB · Views: 60

Hi,

You do not show pin 4 Mclre as pulled up, without that it will not run properly.
 

should i put capacitor connected to ground and to the resistor?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top