Hi Christina86,
This is a BASIC language forum ... ASM help is harder to get here. A quick look at your program......
See Table 4.2 in the 16F745 datasheet. You will see that PORTB resides in BANK0 and TRISB resides in BANK1.
When you want to work with PORTB, you need to make sure you are in BANK0 (clear RP0 and RP1 in the STATUS register)
When you want to work with TRISB, you need to make sure you are in BANK1 (set RB0 as you did)
If you want to continue on and change PORTB values, you need to switch back to BANK0 before updating PORTB (otherwise you will actually update TRISB even though you told the program to update PORTB)
Code:
Start
clrf PORTB ; STATUS defaults to BANK0 - clear PORTB output latch (not really a latch)
bsf STATUS, RP0 ; select bank1
movlw b'00000110' ; Set all pins PORTB 1,2 as Input
MOVWF TRISB ;
bcf STATUS, RP0 ; go back to Bank 0
The 16C745 appears to be an interesting chip – I hope you are using the windowed version.
Being that this is a BASIC forum, I should tell you that what you are trying to do would be trivial with PicBasic or PicBasic Pro
Good Luck
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks