Asm problem

Discussion in 'Programmer's Corner' started by Rk17, May 9, 2011.

  1. Rk17

    Thread Starter Member

    Apr 23, 2011
    ive got this code right here please check it out... im using mplab v8.66 hi-tech c compiler v9.81

    it fails to initialize, what could be wrong with it? need help please.. this is for controlling a servo motor

    Code ( (Unknown Language)):
    1. [FONT=Arial]; FILE: outLed.asm ; AUTH: (Your name here) ; DATE: (date) ; DESC: Makes B0,B2,B4,B6 low and B1,B3,B5,B7 hi ; NOTE: Tested on PIC16F84-04/P.   ; REFs: Easy Pic'n p. 23 (Predko p. 173 is bogus?)   list    p=16F84     radix   hex  ;---------------------------------------------------------------------- ;  cpu equates (memory map) myPortB    equ 0x06        ; (p. 10 defines port address) ;----------------------------------------------------------------------      org 0x000  start    movlw   0x00        ; load W with 0x00 make port B output (p. 45)   tris    myPortB     ; copy W tristate, port B outputs (p. 58)   movlw   b'10101010' ; load W with bit pattern (p. 45)   movwf   myPortB     ; load myPortB with contents of W (p. 45)  circle   goto    circle  ; done      end  ;---------------------------------------------------------------------- ; at burn time, select: ;  memory uprotected ; watchdog timer disabled ;   standard crystal (4 MHz) ;  power-up timer on[/FONT]

    this is the error

    Code ( (Unknown Language)):
    1. Error   [876] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\Tutorials\servo.asm; 2. syntax error
    2. Error   [223] servo.pre; 4. digit out of range
    3. Error   [876] servo.pre; 13. syntax error
    4. Error   [800] servo.pre; 13. undefined symbol "b"
    i got it from this link
    Code ( (Unknown Language)):
  2. DerStrom8

    Well-Known Member

    Feb 20, 2011
    Hi, Rk17.
    You say you're using the Hi-Tech C compiler? Yet you're coding in ASM? That might be your problem--I am pretty sure Hi-Tech is for C programs, not ASM. :p
    (Somebody please correct me if I'm wrong)
    Rk17 likes this.
  3. Rk17

    Thread Starter Member

    Apr 23, 2011
    tnx but isnt it for assembly code too? because if you open a file you could add .asm files doesnt that mean that either asm or c program could be added to the project and compile it either of the 2?
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    I've not used the high-tech compiler but it may well have a project setting for an assembly file. If you're running that compiler inside MPLAB then that definitely handles assembly files.

    C is .c and assembly is .asm and best not to confuse the two.

    If you want to do assembly programs just use MPLAB.