Im learnig PIC programing and this is going to be a post where im going to post questions about it as they arrive to me while learnig or reading some book.
The first one is:
Say i want to set PORTB as outputs, so i write:
ptob equ 0x06
start movlw h"0"
tris ptob
Now, is it a must to loada number on the W registry (movlw) whenever i want to load it on any memoy adress?
Quote from: SISKO on January 29, 2008, 11:04:14 AM
Im learnig PIC programing and this is going to be a post where im going to post questions about it as they arrive to me while learnig or reading some book.
The first one is:
Say i want to set PORTB as outputs, so i write:
ptob equ 0x06
start movlw h"0"
tris ptob
Now, is it a must to loada number on the W registry (movlw) whenever i want to load it on any memoy adress?
What PIC you will be using? Assuming is a PIC16F then it will go like this:
bsf STATUS,RP0 ; Bank 1
movlw h'00'
movwf TRISB
bcf STATUS,RP0 ; Bank 0
or
bsf STATUS,RP0 ; Bank 1
clrf TRISB
bcf STATUS,RP0 ; Bank 0
Check these sites for more info:
http://www.hobbyprojects.com/microcontroller_tutorials.html
http://www.winpicprog.co.uk/pic_tutorial.htm
There are a lot more so you can search for it on the web.
Good luck,
CG ;D