1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Fish Feeder Idea...Help Regards

Discussion in 'Microcontrollers' started by manoj soorya, Feb 20, 2018.

Tags:
  1. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    How is it compile? Can some one can do that make the hex file?
     
  2. Dan Soze

    Dan Soze Member

    Joined:
    Dec 21, 2017
    Messages:
    38
    Likes:
    18
    You are in a hard place.

    I cannot understand the kind of code you need from the descriptions our have posted.

    That you cannot get the code I posted to build with your tools suggests that you do not have much experience with MPLAB or the Microchip assembler.

    If you cut and paste the code I posted it will not build at all. You must have enough experience to use a text editor to remove the parts the assembler does not like. This is in essence a test of your experience.
     
    • Like Like x 1
  3. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    Hi Dan

    Is it Just a referance only?


    OK.... I Got it. Thank you so much for your hardwork.
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  5. Dan Soze

    Dan Soze Member

    Joined:
    Dec 21, 2017
    Messages:
    38
    Likes:
    18
    No. The code I posted is not just for reference, it does function and you can use it as the basis for a source file you can build with your MPLAB tools. But I did make this more difficult for you by posting the list file output from the assembly rather than the source file.

    I did this for three reasons:
    1 - To show you that this code builds without errors using MPASM.
    2 - To determine how much you know about using the MPLAB tools.
    3 - To test how committed you are to learning how to write assembly language programs.

    The process of learning how to convert an assembly language list file in to a source will teach you the basic techniques needed to use the MPLAB tools to build an assembly language project. If you want to profit from the replies to your posts this is something you will need to know. Should the path to this knowledge be too hard for you then stop trying to use PIC assembly language. There are any number of embedded controller environments that are much easier and cheaper to use. The Arduino is quite popular and has a very active world wide user community.
     
    • Like Like x 1
  6. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    Thank you Dan... Its a Very Great help for me. I will try to make the code.
     
  7. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    This option is Great.... Thank you so much, Dan.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  9. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    waw....Thank you So much Dan. Its working on proteus.

    When I compile, I got many error, Not error, warning messages. Just like...

    Warning[205] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 30 : Found directive in column 1. (LIST)
    Warning[205] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 40 : Found directive in column 1. (__CONFIG)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 60 : Found opcode in column 1. (goto)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 62 : Found opcode in column 1. (movwf)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 63 : Found opcode in column 1. (movf)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 64 : Found opcode in column 1. (movwf)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 66 : Found opcode in column 1. (btfsc)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 67 : Found opcode in column 1. (btfss)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 68 : Found opcode in column 1. (goto)
    Warning[203] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 69 : Found opcode in column 1. (bcf)

    But The code Working as I suggest. This is the message of last part of the Build

    Warning[205] C:\DOCUMENTS AND SETTINGS\SETHU\DESKTOP\NEW FOLDER\CODE.ASM 195 : Found directive in column 1. (end)
    Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p12F675 "code.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"Test.cof" /M"Test.map" /W
    MPLINK 4.49, Linker
    Device Database Version 1.14
    Copyright (c) 1998-2011 Microchip Technology Inc.
    Errors : 0

    MP2HEX 4.49, COFF to HEX File Converter
    Copyright (c) 1998-2011 Microchip Technology Inc.
    Errors : 0

    Loaded C:\Documents and Settings\sethu\Desktop\New Folder\Test.cof.
    ----------------------------------------------------------------------
    Debug build of project `C:\Documents and Settings\sethu\Desktop\New Folder\Test.mcp' succeeded.
    Language tool versions: MPASMWIN.exe v5.51, mplink.exe v4.49, mplib.exe v4.49
    Preprocessor symbol `__DEBUG' is defined.
    Mon Feb 26 21:55:09 2018
    ----------------------------------------------------------------------
    BUILD SUCCEEDED


    Anyway thank you so much for the Help.

    and how to overcome this warning messages?

    Thank you so much for your Help. Please guide me, If you are on free of time...

    Thank you.
     
  10. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
  11. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    Hi Dan...

    Now the Error is less. See..

    Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F675 "code.asm" /l"code.lst" /e"code.err" /o"code.o" /d__DEBUG=1
    Message[302] D:\1\1\EN PUDN COM\2018\SWITCH\FISH FEEDER IDEA 12F675\CODE.ASM 97 : Register in operand not in bank 0. Ensure that bank bits are correct.
    Message[302] D:\1\1\EN PUDN COM\2018\SWITCH\FISH FEEDER IDEA 12F675\CODE.ASM 100 : Register in operand not in bank 0. Ensure that bank bits are correct.
    Message[302] D:\1\1\EN PUDN COM\2018\SWITCH\FISH FEEDER IDEA 12F675\CODE.ASM 101 : Register in operand not in bank 0. Ensure that bank bits are correct.
    Message[302] D:\1\1\EN PUDN COM\2018\SWITCH\FISH FEEDER IDEA 12F675\CODE.ASM 103 : Register in operand not in bank 0. Ensure that bank bits are correct.
    Warning[205] D:\1\1\EN PUDN COM\2018\SWITCH\FISH FEEDER IDEA 12F675\CODE.ASM 195 : Found directive in column 1. (end)
    Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p12F675 "code.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"Test.cof" /M"Test.map" /W
    MPLINK 4.49, Linker
    Device Database Version 1.14
    Copyright (c) 1998-2011 Microchip Technology Inc.
    Errors : 0

    MP2HEX 4.49, COFF to HEX File Converter
    Copyright (c) 1998-2011 Microchip Technology Inc.
    Errors : 0

    Loaded D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.cof.
    ----------------------------------------------------------------------
    Debug build of project `D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.mcp' succeeded.
    Language tool versions: MPASMWIN.exe v5.51, mplink.exe v4.49, mplib.exe v4.49
    Preprocessor symbol `__DEBUG' is defined.
    Mon Feb 26 22:49:02 2018
    ----------------------------------------------------------------------
    BUILD SUCCEEDED


    I will try to overcome this too...

    Thank you Dan..
     
  12. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    wawawawwawawwww......

    Finally I Overcome from that error... See..

    Debug build of project `D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.mcp' started.
    Language tool versions: MPASMWIN.exe v5.51, mplink.exe v4.49, mplib.exe v4.49
    Preprocessor symbol `__DEBUG' is defined.
    Mon Feb 26 22:56:12 2018
    ----------------------------------------------------------------------
    Clean: Deleting intermediary and output files.
    Clean: Deleted file "D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\code.o".
    Clean: Deleted file "D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\code.err".
    Clean: Deleted file "D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\code.lst".
    Clean: Deleted file "D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.cof".
    Clean: Deleted file "D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.hex".
    Clean: Done.
    Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F675 "code.asm" /l"code.lst" /e"code.err" /o"code.o" /d__DEBUG=1
    Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p12F675 "code.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"Test.cof" /M"Test.map" /W
    MPLINK 4.49, Linker
    Device Database Version 1.14
    Copyright (c) 1998-2011 Microchip Technology Inc.
    Errors : 0

    MP2HEX 4.49, COFF to HEX File Converter
    Copyright (c) 1998-2011 Microchip Technology Inc.
    Errors : 0

    Loaded D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.cof.
    ----------------------------------------------------------------------
    Debug build of project `D:\1\1\en pudn com\2018\Switch\Fish Feeder IDEA 12F675\Test.mcp' succeeded.
    Language tool versions: MPASMWIN.exe v5.51, mplink.exe v4.49, mplib.exe v4.49
    Preprocessor symbol `__DEBUG' is defined.
    Mon Feb 26 22:56:14 2018
    ----------------------------------------------------------------------
    BUILD SUCCEEDED



    Thank you Dan.....
     
  13. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    and This is the code I edit...

    Code (text):


      list n=0, c=150, r=dec      
    ; File: main.asm      
    ; Target: PIC12F675      
    ; Created: 2018-02-23      
    ; Author: Dan1138      
    ;*********************************************************************      
    ;                          ___ ___      
    ;                   VDD ->|1  U  8|<- VSS      
    ;                  LED1 <>|2     7|<> LED3      
    ;                  LED2 <>|3     6|<> LED4      
    ;                  SW1n ->|4     5|<> LED5      
    ;                          ¯¯¯¯¯¯¯      
    ;                         PIC12F675      
    ;      
    ;*********************************************************************      
    ;      
    ;  If the switch is Press and hold (My timer output is enable for 1 Minute minimum) either Press, all LED will be ON.      
    ;  After 1 Second, LED 1 Turn Off,      
    ;  After 2 Second, LED 2 Turn Off      
    ;  After 4 Second, LED 3 Turn Off      
    ;  After 6 Second, LED 4 Turn Off      
    ;  After 8 Second, LED 5 Turn Off.      
    ;      
    ;  (5 LED is used for Manual Timer selection for the Motor will Enable..)      
    ;      
    ;*********************************************************************      
    ; See: https://www.electro-tech-online.com/threads/fish-feeder-idea-help-regards.153045/      
    ;*********************************************************************      
    #include <p12f675.inc>      
       LIST      
           
    ;==========================================================================      
    ;  MPASM PIC12F675 processor include      
    ;      
    ;  (c) Copyright 1999-2013 Microchip Technology, All rights reserved      
    ;==========================================================================      
       LIST              
       errorlevel -302         ; suppress banksel warni   ng   messages      
                   
       __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON   &   _MCLRE_OFF & _BODEN_ON & _CP_OFF & _CPD_OFF      
                   
    #define TIMER0_INTERRUPTS_PER_SECOND D'4000'              
    #define LED1 GPIO,5              
    #define LED2 GPIO,4              
    #define LED3 GPIO,0              
    #define LED4 GPIO,2              
    #define LED5 GPIO,1              
    #define SW1n GPIO,3              
                   
                   
    ISR_DATA    udata_shr  0x20
    WREG_save       res 1
    STATUS_save     res 1

    TIMER_DATA  udata_shr
    IntsInOneSecond res 2
    Seconds         res 1

    RESET_CODE  CODE 0x000
       goto    Start
    ISR_CODE    CODE 0x004
       movwf   WREG_save
       movf    STATUS,W
       movwf   STATUS_save

       btfsc   INTCON,TMR0IE
       btfss   INTCON,TMR0IF
       goto    ISR_Exit
       bcf     INTCON,TMR0IF
       movlw   256-250+3
       addwf   TMR0,F
       movlw   -1
       addwf   IntsInOneSecond,F
       skpc
       addwf   IntsInOneSecond+1,F
       skpnc
       goto    ISR_Exit
       movlw   HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
       movwf   IntsInOneSecond+1
       movlw   LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
       movwf   IntsInOneSecond
       incf    Seconds,F

    ISR_Exit:      
       movf    STATUS_save,W      
       movwf   STATUS      
       swapf   WREG_save,F      
       swapf   WREG_save,W      
       retfie

    START_CODE  CODE          
    Start:          
       btfsc   STATUS,RP0          
       goto    OscillatorCalibrationFailed          
       banksel OSCCAL          
       call    GetOSCCAL          
       movwf   OSCCAL          
    OscillatorCalibrationFailed:          
       banksel ANSEL          
       clrf    ANSEL          
       clrf    TRISIO          
       movlw   B'11011111'          
       movwf   OPTION_REG          
       banksel INTCON          
       clrf    INTCON          
       clrf    GPIO          
       movlw   0x07          
       movwf   CMCON          
       movlw   HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)          
       movwf   IntsInOneSecond+1          
       movlw   LOW(TIMER0_INTERRUPTS_PER_SECOND-1)          
       movwf   IntsInOneSecond          
       clrf    Seconds          
       clrf    TMR0          
       movlw   256-250+3          
       addwf   TMR0,F          
       bsf     INTCON,TMR0IE          
       bsf     INTCON,GIE

               
               
               
    AppStart:          
       clrf    GPIO          
    AppLoop:          
       btfsc   SW1n          
       goto    AppLoop          
       bcf     INTCON,TMR0IE          
       movlw   HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)          
       movwf   IntsInOneSecond+1          
       movlw   LOW(TIMER0_INTERRUPTS_PER_SECOND-1)          
       movwf   IntsInOneSecond          
       clrf    Seconds          
       movlw   B'00110111' ; LED1-5 on          
       movwf   GPIO          
       bsf     INTCON,TMR0IE          
    AppTimeout:          
       movf    Seconds,W          
       xorlw   D'1'          
       skpnz          
       goto    LED1_off          
       xorlw   D'1'^D'2'          
       skpnz          
       goto    LED2_off          
       xorlw   D'2'^D'4'          
       skpnz          
       goto    LED3_off          
       xorlw   D'4'^D'6'          
       skpnz          
       goto    LED4_off          
       xorlw   D'6'^D'8'          
       skpnz          
       goto    LED5_off          
       xorlw   D'8'          
       sublw   D'8'          
       skpc          
       goto    WaitForButtonUp          
    CheckSwitch:          
       btfsc   SW1n          
       goto    AppStart          
       goto    AppTimeout
    ;
    ;
    ;
    WaitForButtonUp:              
       btfsc   SW1n              
       goto    AppStart              
       goto    WaitForButtonUp
    ;
    ;
    ;
    LED1_off:              
       movlw   B'00010111' ; LED1   off              
       movwf   GPIO              
       goto    CheckSwitch              
    LED2_off:              
       movlw   B'00000111' ; LED1-2 off              
       movwf   GPIO              
       goto    CheckSwitch              
    LED3_off:              
       movlw   B'00000110' ; LED1-3 off              
       movwf   GPIO              
       goto    CheckSwitch              
    LED4_off:              
       movlw   B'00000010' ; LED1-4 off              
       movwf   GPIO              
       goto    CheckSwitch              
    LED5_off:              
       movlw   B'00000000' ; LED1-5 off              
       movwf   GPIO              
       goto    CheckSwitch  

    OSCCAL_CODE CODE 0x3ff
    GetOSCCAL:
       end


    [end code]

    is it okey, Dan?
     
  14. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India

    Great Testing... Thank you so much Dan...Thank you so much.
     
  15. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
  16. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India

    But this error still in Proteus.....On real Hardware, Its working Sooooooooppper..100% error Free.

    Thank you so much Dan for your Valuable time, I missuse, Sorry.

    Have a nice day Dear, Dan
     
  17. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India

    waw.... Now I know the code where to places...

    Keep the column for overcome the warnning like this ( Found directive in column 1. (LIST)....Great Teaching.

    Thank you so much from My heart, Dear Dan Soze....
     
  18. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,802
    Likes:
    958
    Location:
    Rochdale UK
    Deleted
     
  19. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India

    Deleted? What you mean Ian? Is I post something Wrong?
     
  20. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,802
    Likes:
    958
    Location:
    Rochdale UK
    No I answered a post before I realise it was already answered...
     
  21. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    Thank You
     
    Last edited: Feb 26, 2018
  22. manoj soorya

    manoj soorya Member

    Joined:
    Aug 23, 2014
    Messages:
    292
    Likes:
    4
    Location:
    India
    Hello Dan

    This is the hex file I already get. Its working 100%.
     

    Attached Files:

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice