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] I am not getting o/p for this program...using pic16f887

Status
Not open for further replies.

ashwini jayaraman

Member level 2
Joined
Jan 17, 2013
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,601
Hello members,

I tried to write a switch to led pgm using embedded C ..got the o/p..but couldnt implement the same concept in ALP..here is my program..couldnt guess any logical error so far..there is no syntax error also while I tried building it..


#include<p16f887.inc>
list p=16f887
ORG 0x00
GOTO MAIN
ORG 0x12
MAIN:
banksel ANSEL
banksel ANSELH
banksel ADCON0
banksel ADCON1
banksel ADRESH
banksel ADRESL
banksel TRISD
banksel PORTD
CLRF ANSEL
CLRF ANSELH
CLRF ADCON0
CLRF ADCON1
CLRF ADRESH
CLRF ADRESL
CLRF TRISD
movlw 0xFF
banksel TRISB
movwf TRISB
banksel PORTB
movf PORTB,0
banksel PORTD
movwf PORTD
END
 

The program is total nonsense!

"banksel" changes the register bank so you can access the named register but it does not change the register value itself. You should use banksel, change the register then use banksel again if necessary to access the next register.
At the moment only the first banksel PORTD does anything and it leaves the wrong bank selected for the next instructions.

Also be careful wih the values you use in ORG directives, do you really want to jump to address 0x12?

Brian.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top