andyyeap
Newbie level 5
hi guys i really need some help to convert following assembly codes to hex file... im having problems while converting those code can any of u guys help me with this problem can help me convert these assembly language to hex file? thanks alot
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 ; This file is a basic code template for object module code * ; generation on the PIC10F222. This file contains the * ; basic code building blocks to build upon. * ; * ; Refer to the MPASM User's Guide for additional information on * ; features of the assembler and linker. * ; * ; Refer to the respective PIC data sheet for additional * ; information on the instruction set. * ; * ; * ;********************************************************************** ; * ; Filename: xxx.asm * ; Date: * ; File Version: * ; * ; Author: * ; Company: * ; * ; * ;********************************************************************** ; * ; Files required: P10F222.INC * ; * ; * ; * ;********************************************************************** ; * ; Notes: * ; GPIO0=TRANSISTOR DRIVE * ; GPIO1=PICIN * ; GPIO3=JUMPER * ; GPIO2=UNUSED * ;********************************************************************** list p=10F222 ; list directive to define processor #include <p10F222.inc> ; processor specific variable definitions __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _MCPU_OFF & _IOFSCS_4MHZ ; '__CONFIG' directive is used to embed configuration word within .asm file. ; The lables following the directive are located in the respective .inc file. ; See respective data sheet for additional information on configuration word. ;***** VARIABLE DEFINITIONS TEMP_VAR UDATA TEMP1 RES 1 ;DELAY REGISTER1 TEMP2 RES 1 ;DELAY REGISTER2 TEMP3 RES 1 ;DELAY REGISTER3 TEMP4 RES 1 ;DELAY REGISTER4 TEMP5 RES 1 ;TIMING REGISTER TEMP6 RES 1 ;TINING REGISTER ;********************************************************************** RESET_VECTOR CODE 0xFF ; processor reset vector ; Internal RC calibration value is placed at location 0xFF by Microchip ; as a movlw k, where the k is a literal value. MAIN CODE 0x000 movwf OSCCAL ; update register with factory cal value INITIALIZE MOVLW B'0010' ; GPIO1=COMPARATOR IN - GPIO0-RELAY ACTIVATE TRIS GPIO ; INITIALIZE CLRF ADCON0 ; ADC DISABLE CLRF GPIO MOVLW B'00001000' OPTION ; ENABLE GPIO2 AS A DIGITAL PORT CLRF GPIO START: SCAN1: BTFSS GPIO,1 GOTO SCAN1 ENSURE: BTFSC GPIO,1 GOTO ENSURE CALL LOOP1 COUNTDOWN: MOVLW 0XFF MOVWF TEMP5 MOVLW 0XFF MOVWF TEMP6 COUNTDOWN2: BTFSC GPIO,1 GOTO RELAYACTIVATE DECFSZ TEMP5 GOTO COUNTDOWN2 MOVLW 0XFF MOVWF TEMP5 DECFSZ TEMP6 GOTO COUNTDOWN2 GOTO SCAN1 RELAYACTIVATE: BSF GPIO,0 CALL LOOP1 CALL LOOP1 CALL LOOP1 SCAN2: BTFSS GPIO,1 GOTO SCAN2 ENSURE2: BTFSC GPIO,1 GOTO ENSURE2 CALL LOOP1 COUNTDOWN3: MOVLW 0XFF MOVWF TEMP5 MOVLW 0XFF MOVWF TEMP6 COUNTDOWN4: BTFSC GPIO,1 GOTO RELAYDEACTIVATE DECFSZ TEMP5 GOTO COUNTDOWN4 MOVLW 0XFF MOVWF TEMP5 DECFSZ TEMP6 GOTO COUNTDOWN4 GOTO SCAN2 RELAYDEACTIVATE: BCF GPIO,0 RESET LOOP1: MOVLW 0X00 MOVWF TEMP1 MOVLW 0XF0 MOVWF TEMP2 LOOP2: DECFSZ TEMP1 GOTO LOOP2 DECFSZ TEMP2 GOTO LOOP2 RETURN ; remaining code goes here END ; directive 'end of program'
Last edited: