Software > Software

Problems with a Botrics board running a simple program


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

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
   bsf    STATUS, RP0
   movlw    b'00001100'
   movwf   TRISB
   bcf      OPTION_REG, 7
   bcf      STATUS, RP0
   movlw   0x00
   movwf   PORTB

   btfsc   PORTB, board_button1
   bsf      PORTB, board_LED1

   btfsc   PORTB, board_button2
   bsf      PORTB, board_LED2   

   goto testloop
--- End quote ---

and here is my .HEX

--- Quote ---:02000600502880

--- End quote --- 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


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

hehe yeap  :P

Any reason you cannot do it in C?

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.


[0] Message Index

Go to full version