Software > Software

Problems with a Botrics board running a simple program

(1/1)

JesseWelling:
OK so I just got my Botrics board which runs a PIC 16F877A.
I ran their test program that makes the LEDs flash back and forth.
But now I wanted to write my own test for it. The idea is to have both LEDs out till you press one of the buttons.
After you press one of the buttons, the corresponding light should go on. *BUT* nothing happens.

Here is my .ASM

--- Quote ---LIST P=16f877, R=DEC
   INCLUDE "P16F877A.inc"

;variables
ScratchPad         EQU   0x20

;literal constants defined for cerebellum
board_button1   EQU 4
board_button2   EQU   5
board_LED1      EQU 0
board_LED2      EQU 2

   ORG    0x03
   goto   start
   ORG      0x50
start
   bsf    STATUS, RP0
   movlw    b'00001100'
   movwf   TRISB
   bcf      OPTION_REG, 7
   bcf      STATUS, RP0
   movlw   0x00
   movwf   PORTB


testloop
   btfsc   PORTB, board_button1
   bsf      PORTB, board_LED1


   btfsc   PORTB, board_button2
   bsf      PORTB, board_LED2   


   goto testloop
   END
--- End quote ---

and here is my .HEX


--- Quote ---:02000600502880
:04000A00003400348A
:1000A00083160C3086008113831200308600061AF6
:0800B0000614861A06155728F4
:00000001FF

--- End quote ---

SO....am I not setting up the Linker correctly in MP-LAB or am i not programing the pic correctly with regards to the input and output from PORTB ??? and how do you code interupts BTW? I'm kinda flying by the seat of my pants here, so sorry for the request for massive amounts of info here.
Reference to Cerebellum site http://www.botrics.com/support/cereb/manual/chapter3/3-7-user-devs.html

JesseWelling:
*BUMP*

so ummm am I the only one silly enough to program in assembly and that's why no one is helping me out?  :-\

Admin:
hehe yeap  :P

Any reason you cannot do it in C?

JesseWelling:
class requirement  :-[

But that's ok I figured it out.

--- Quote ---bcf      OPTION_REG, 7
--- End quote ---
enables weak pull ups on PORTB using internal resistors.
But it makes ALL of PORTB an input.
BUT my board has resistors already so I don't need a weak pull up so if I erase that line it works fine
And I had my TRISB MSB and LSB backwards because I didn't read my data sheet closely enough.
 :P :P :P

But thanks for responding. I thought I smelled or something.

Navigation

[0] Message Index

Go to full version