PIC Assembler Program

AlbertHall

Joined Jun 4, 2014
10,018
It's been a while since I did asm.
I don't know what is wrong with the config line but the line labels need to be followed by a colon.
 

MaxHeadRoom

Joined Jul 18, 2013
20,878
It's been a while since I did asm.
I don't know what is wrong with the config line but the line labels need to be followed by a colon.
I believe you are thinking of the alternate format?

For me, the old MPLAB IDE 8.92 is better for assembly.
Also the instruction manual shows all alarm and message content.
Max.
 

jpanhalt

Joined Jan 18, 2008
9,699
1591545110256.png
I do not like that way of doing it. I like moving the binary or hex literal. Takes the same length of time (Tcy's) and is unambiguous. But you seem to be setting GP1 to an input. Setting an Input high doesn't do anything, as they usually have weak pull-ups enabled anyway.

Can you post your code in a more readable manner using [code] <content> [/code] or "plain" tags in the same way?
 

JohnInTX

Joined Jun 26, 2012
4,113
The #include file is mis-named. It is p10f200 not pic10f200. If you fix that, it assembles OK.

While we're at it:
It's helpful to use a colon after the label names. It makes them stand out.
The __ CONFIG names are out of date but are kept for convenience. You can set the chip config using Window->Target Memory Views->Configuration Bits. Select what you want using the dropdown menus, click Generate Source Code to Output then copy/paste that to your code. When you do that you get the latest stuff PLUS it includes the properly spelled header file:
Code:
; PIC10F200 Configuration Bit Settings

; Assembly source line config statements

#include "p10f200.inc"

; CONFIG
; __config 0xFEB
 __CONFIG _WDTE_OFF & _CP_OFF & _MCLRE_OFF
I agree with @jpanhalt , just use a binary representation of the init value for the port.
I like explicitly initializing ALL bits of ALL IO after reset and not relying on the reset values unless you are just completely out of codespace.

Have fun!
 

be80be

Joined Jul 5, 2008
2,046
Here how to do what the TS is trying to do
Code:
; TODO INSERT CONFIG CODE HERE USING CONFIG BITS GENERATOR
#include "p10f200.inc"

; CONFIG
; __config 0xFEB
 __CONFIG _WDTE_OFF & _CP_OFF & _MCLRE_OFF

    
RES_VECT  CODE    0x0000            ; processor reset vector
    GOTO    START                   ; go to beginning of program

; TODO ADD INTERRUPTS HERE IF USED

MAIN_PROG CODE                      ; let linker place main program

START
    MOVLW  0x0
    TRIS   GPIO   ;set's TRIS to ouput
    BSF    GPIO,1 ;set's GP1 high
LOOP
    GOTO LOOP                          ; loop forever

    END
 
Top