(noob)hello world?


Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Nov 2007
    Posts
    2

    Default (noob)hello world?

    Sorry for cluttering your nice forum with such a total noob question, but I'm trying squeeze through the rabbit hole as it were, into the wonderful world (or hellish netherworld?) of PIC programming, but I've hit a snag that is causing me quite a headache.

    I am trying to program a PIC16F874A. MPASM is the assembler I'm using.

    My goal is to light up an LED on bit 0 of port D. Seems simple eh?

    Here is my very simple program:


    Code:
    #include P16F874A.INC
    _CONFIG _FCMEN_OFF&_IESO_OFF&_BOD_OFF&_CPD_OFF&_CP_OFF&_PWRTE_OFF&_WDT_OFF&_INTRC_OSC_NOCLKOUT&_MCLRE_ON
    	org 0
    
    Start
    	BSF	STATUS,RP0	;select bank1
    	BCF	TRISD,0		;set IO pin d0 as output
    	BCF	STATUS,RP0	;select bank0
    	BSF	PORTD,0		;TURN ON LED
    	GOTO	$		;WAIT HERE
    	END
    And here are the extremely annoying contents of the error file:

    Error[122] C:\PROGRAMS\HELLOWORLD.TXT 2 : Illegal opcode (_FCMEN_OFF)
    Message[302] C:\PROGRAMS\HELLOWORLD.TXT 7 : Register in operand not in bank 0. Ensure that bank bits are correct.

    *bangs head against table*

    The first error about the opcode confuses me, but it isn't my main gripe, as those config settings (whatever they are) are probably not important to my hello world program.

    Indeed, the thing that aggravates me is the second message "register in operand not in bank 0" etc... but the first thing I want my program to do is switch to bank 1, not 0, and for some reason that's not happening.


    The first line of my program after START is:

    BSF STATUS,RP0

    Isn't that supposed to switch me to bank1 (which is where the TRISTD register is)?

    Can anybody tell me where I'm going wrong?

    Thanks!
    Last edited by m4gill4; - 29th November 2007 at 23:50.

Similar Threads

  1. Welcome into PIC world
    By shafi008 in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 29th April 2009, 06:51
  2. Remote Control World !
    By iugmoh in forum General
    Replies: 4
    Last Post: - 22nd April 2008, 23:03
  3. wired world
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th February 2007, 16:23
  4. Is the world ready for TTL RS-232 serial?
    By hansknec in forum Serial
    Replies: 7
    Last Post: - 26th July 2005, 14:56
  5. pulsin fails in real world
    By peu in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th March 2005, 10:32

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts