go_away

Author Topic: Problems with a Botrics board running a simple program  (Read 4977 times)

0 Members and 1 Guest are viewing this topic.

Offline JesseWellingTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Problems with a Botrics board running a simple program
« on: March 10, 2006, 07:22:22 PM »
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


and here is my .HEX

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


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
« Last Edit: March 11, 2006, 02:07:49 AM by JesseWelling »

Offline JesseWellingTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: Problems with a Botrics board running a simple program
« Reply #1 on: March 18, 2006, 11:27:03 PM »
*BUMP*

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

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Problems with a Botrics board running a simple program
« Reply #2 on: March 20, 2006, 09:07:47 AM »
hehe yeap  :P

Any reason you cannot do it in C?

Offline JesseWellingTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: Problems with a Botrics board running a simple program
« Reply #3 on: March 21, 2006, 08:41:14 AM »
class requirement  :-[

But that's ok I figured it out.
Quote
bcf      OPTION_REG, 7
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.
« Last Edit: March 21, 2006, 08:47:13 AM by JesseWelling »

 


Get Your Ad Here

data_list