Continue to Site

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.

  • 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.

Fish Feeder Idea...Help Regards

Status
Not open for further replies.
I am using MPlab 8.33. Its support MPASMWIN 5.31.... This source not run on MPASMWIN 5.31. Got error.
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.
 
Hi Dan
Is it Just a reference only?

OK.... I Got it. Thank you so much for your hard work.
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.
 
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.
 
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..
 
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.....
 
and This is the code I edit...

Code:
  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?
 
3 - To test how committed you are to learning how to write assembly language programs.


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....
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top