code error, HELP

Discussion in 'Embedded Systems and Microcontrollers' started by hussein89, Jun 1, 2014.

  1. hussein89

    Thread Starter New Member

    Jun 1, 2014
    2
    0
    i'm new to microcontroller, i'm using MPLAB to implement a program that enables me to flash a LED using push button, and after four presses, another led is eternally switched on. this is the code with the output:

    THE CODE:
    Code ( (Unknown Language)):
    1.  
    2. #include <p16F84a.inc>
    3.  
    4. __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
    5.  
    6. CBLOCK 0x0c
    7.     counter
    8.  
    9. ENDC
    10.     movlw 0x04
    11.     movwf counter
    12.  
    13. org 0x00
    14. bsf STATUS, RP0
    15. movlw 0x01
    16. movwf TRISB
    17. movlw 0x00
    18. movwf TRISA
    19. bcf STATUS, RP0
    20.  
    21. Start
    22. bcf PORTA, 0
    23.  
    24. push
    25. btfsc PORTB,0
    26. goto count
    27.  
    28. goto push
    29.  
    30. count
    31. decfsz counter, f
    32. goto push
    33.  
    34. goto second_led
    35.  
    36. second_led
    37. bsf PORTA, 0
    38.  
    39. end
    40.  
    the OUTPUT:

    Clean: Deleting intermediary and output files.
    Clean: Done.
    Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "led flash.asm" /l"led flash.lst" /e"led flash.err" /d__DEBUG=1
    Warning[205] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 3 : Found directive in column 1. (__CONFIG)
    Warning[205] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 5 : Found directive in column 1. (CBLOCK)
    Warning[205] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 8 : Found directive in column 1. (ENDC)
    Warning[205] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 12 : Found directive in column 1. (org)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 13 : Found opcode in column 1. (bsf)
    Error[118] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 13 : Overwriting previous address contents (0000)
    Error[118] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 13 : Overwriting previous address contents (0000)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 14 : Found opcode in column 1. (movlw)
    Error[118] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 14 : Overwriting previous address contents (0001)
    Error[118] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 14 : Overwriting previous address contents (0001)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 15 : Found opcode in column 1. (movwf)
    Message[302] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 15 : Register in operand not in bank 0. Ensure that bank bits are correct.
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 16 : Found opcode in column 1. (movlw)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 17 : Found opcode in column 1. (movwf)
    Message[302] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 17 : Register in operand not in bank 0. Ensure that bank bits are correct.
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 18 : Found opcode in column 1. (bcf)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 21 : Found opcode in column 1. (bcf)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 24 : Found opcode in column 1. (btfsc)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 25 : Found opcode in column 1. (goto)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 27 : Found opcode in column 1. (goto)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 30 : Found opcode in column 1. (decfsz)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 31 : Found opcode in column 1. (goto)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 33 : Found opcode in column 1. (goto)
    Warning[203] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 36 : Found opcode in column 1. (bsf)
    Warning[205] C:\USERS\GIG\DESKTOP\LAB\LED FLASH\LED FLASH.ASM 38 : Found directive in column 1. (end)
    Halting build on first failure as requested.
    ----------------------------------------------------------------------
    Debug build of project `C:\Users\GIG\Desktop\lab\led flash\led flash.mcp' failed.
    Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
    Preprocessor symbol `__DEBUG' is defined.
    Sun Jun 01 12:08:31 2014
    ----------------------------------------------------------------------
    BUILD FAILED
     
    Last edited by a moderator: Jun 1, 2014
  2. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi 89,
    Try this, it now assembles. Ensure that you keep it formatted as posted.
    E
    Code ( (Unknown Language)):
    1.  
    2.     list      p=16F84A    
    3.     #include <p16F84a.inc>
    4.    
    5.     errorlevel -302, -207
    6.    
    7.     __config _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
    8.  
    9.     cblock    0x0c
    10.     counter
    11.     endc
    12.        
    13.     org    0x00
    14.     bsf    STATUS, RP0
    15.     movlw    0x01
    16.     movwf    TRISB
    17.     movlw    0x00
    18.     movwf    TRISA
    19.     bcf    STATUS, RP0
    20.  
    21. Start
    22.     movlw    0x04
    23.     movwf    counter
    24.     bcf    PORTA, 0
    25.  
    26. push        
    27.     btfsc    PORTB,0
    28.     goto    count
    29.  
    30.     goto    push
    31.  
    32. count        
    33.     decfsz    counter, f
    34.     goto    push
    35.  
    36.     goto    second_led
    37.  
    38. second_led
    39.     bsf    PORTA, 0
    40.     end
    41.  
     
  3. hussein89

    Thread Starter New Member

    Jun 1, 2014
    2
    0
    Eric, many many thanks
     
Loading...