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.

Converting asm to hex

Status
Not open for further replies.
Post #8 links to the ASM file, though as stated by MaxHeadRoom78, there are missing 'include' files listed within the ASM file. The website (listed in the ASM) is a mess, very hard to follow. Utter disaster. If the HEX file doesn't work, I don't know where we can go from here. :/

I don't care what you think are the TS's source files. From my point of view, the TS should post them. He hasn't done that. Let me recommend that you visit the TS's profile page and review his prior, extremely confusing posts.

If you are sure the files you point to are the files that the TS wants, why don't you post the hex file for them and solve the question? Problem solved.
 
Jpanhalt....my problem is the circuit is working but the LEDis not working as it should work. I do not know what i missed.
 
Converting the hex to asm isn't a problem... Oshonsoft has a great disassembler!!

Code:
;-----------------------------------
;PIC DISASSEMBLER LISTING
;Label  Instruction
;-----------------------------------
   GOTO L1
L31:   MOVWF 0x29
   MOVLW 0x42
   MOVWF 0x20
   MOVLW 0x0F
   MOVWF 0x21
   CALL L2
   BTFSC STATUS,Z
   BCF 0x12,0
   BTFSS STATUS,Z
   BSF 0x12,0
   ADDLW 0xFC
   BTFSS STATUS,C
   BCF 0x12,1
   BTFSC STATUS,C
   BSF 0x12,1
   MOVLW 0x40
   MOVWF 0x20
   MOVLW 0x42
   MOVWF 0x21
   MOVLW 0x0F
   MOVWF 0x24
   CLRF 0x25
   BTFSC 0x12,0
   CALL L3
   BTFSC 0x12,1
   CALL L3
   CALL L4
   DECF 0x20,W
   BSF STATUS,RP0
   MOVWF 0x12
   BCF STATUS,RP0
   MOVF 0x20,W
   MOVWF 0x22
   MOVF 0x21,W
   MOVWF 0x23
   MOVF 0x28,W
   MOVWF 0x26
   MOVWF 0x27
   INCFSZ 0x28,W
   CLRF 0x27
   CALL L5
   MOVF 0x25,W
   MOVWF 0x15
   MOVLW 0x0C
   MOVWF 0x17
   BTFSC 0x24,7
   BSF 0x17,5
   BTFSC 0x24,6
   BSF 0x17,4
   BSF STATUS,RP0
   BCF 0x06,3
   BCF STATUS,RP0
   BSF 0x12,2
   GOTO L6
L3:   CALL L7
L7:   BCF STATUS,C
   RRF 0x24,F
   RRF 0x21,F
   RRF 0x20,F
   RETURN
L27:   MOVWF 0x23
   MOVF 0x36,W
   MOVWF FSR
   COMF 0x34,W
   CALL L8
   BCF FSR,7
   MOVF 0x23,F
   BTFSC STATUS,Z
   GOTO L6
   MOVLW 0xF0
   MOVWF 0x25
L12:   MOVF 0x22,W
   IORLW 0x80
   MOVWF 0x24
L14:   MOVLW 0xF0
   DECF 0x25,F
   BTFSC STATUS,Z
   MOVWF 0x25
   BTFSC STATUS,Z
   DECF 0x23,F
   BTFSC STATUS,Z
   GOTO L6
   GOTO L9
L9:   CALL L10
   CLRW
   BTFSC 0x20,0
   MOVF 0x34,W
   BTFSS 0x22,7
   MOVF 0x34,W
   MOVF 0x22,F
   BTFSC STATUS,Z
   CLRW
   INCFSZ 0x24,F
   GOTO L11
   XORWF INDF,F
   GOTO L12
L11:   GOTO L13
L13:   NOP
   GOTO L14
L8:   BSF FSR,7
   ANDWF INDF,F
   GOTO L6
L10:   MOVF 0x21,W
   IORWF 0x20,W
   BTFSC STATUS,Z
   INCF 0x20,F
   MOVLW 0x80
   BTFSC 0x20,4
   XORWF 0x21,F
   BTFSC 0x20,2
   XORWF 0x21,F
   BTFSC 0x20,1
   XORWF 0x21,F
   RLF 0x21,W
   RLF 0x20,F
   RLF 0x21,F
   GOTO L6
L28:   CLRF 0x23
   MOVWF 0x22
L16:   MOVLW 0xFF
   ADDWF 0x22,F
   BTFSS STATUS,C
   ADDWF 0x23,F
   BTFSS STATUS,C
   GOTO L6
   MOVLW 0x03
   MOVWF 0x21
   MOVLW 0xDF
   CALL L15
   GOTO L16
L39:   CLRF 0x21
L15:   ADDLW 0xE8
   MOVWF 0x20
   COMF 0x21,F
   MOVLW 0xFC
   BTFSS STATUS,C
   GOTO L17
L18:   ADDWF 0x20,F
   BTFSC STATUS,C
   GOTO L18
L17:   ADDWF 0x20,F
   CLRWDT
   INCFSZ 0x21,F
   GOTO L18
   BTFSC 0x20,0
   GOTO L19
L19:   BTFSS 0x20,1
   GOTO L20
   NOP
   GOTO L20
L20:   RETURN
L29:   MOVWF 0x22
   MOVLW 0x01
   GOTO L21
L21:   MOVWF 0x28
   MOVF 0x23,W
   SUBWF 0x21,W
   BTFSS STATUS,Z
   GOTO L22
   MOVF 0x22,W
   SUBWF 0x20,W
L22:   MOVLW 0x04
   BTFSC STATUS,C
   MOVLW 0x01
   BTFSC STATUS,Z
   MOVLW 0x02
   ANDWF 0x28,W
   BTFSS STATUS,Z
   MOVLW 0xFF
   GOTO L6
L2:   CLRF 0x25
   CLRF 0x24
L4:   MOVLW 0x10
   MOVWF 0x26
L24:   RLF 0x21,W
   RLF 0x24,F
   RLF 0x25,F
   MOVF 0x22,W
   SUBWF 0x24,F
   MOVF 0x23,W
   BTFSS STATUS,C
   INCFSZ 0x23,W
   SUBWF 0x25,F
   BTFSC STATUS,C
   GOTO L23
   MOVF 0x22,W
   ADDWF 0x24,F
   MOVF 0x23,W
   BTFSC STATUS,C
   INCFSZ 0x23,W
   ADDWF 0x25,F
   BCF STATUS,C
L23:   RLF 0x20,F
   RLF 0x21,F
   DECFSZ 0x26,F
   GOTO L24
   MOVF 0x20,W
   GOTO L6
L5:   MOVLW 0x10
   MOVWF 0x28
   CLRF 0x21
   CLRF 0x20
L26:   RRF 0x27,F
   RRF 0x26,F
   BTFSS STATUS,C
   GOTO L25
   MOVF 0x22,W
   ADDWF 0x20,F
   MOVF 0x23,W
   BTFSC STATUS,C
   INCFSZ 0x23,W
   ADDWF 0x21,F
L25:   RRF 0x21,F
   RRF 0x20,F
   RRF 0x25,F
   RRF 0x24,F
   DECFSZ 0x28,F
   GOTO L26
   MOVF 0x24,W
   GOTO L6
L6:   BCF STATUS,IRP
   BCF STATUS,RP1
   BCF STATUS,RP0
   CLRWDT
   RETURN
L1:   MOVLW 0x07
   MOVWF 0x1F
   BSF STATUS,RP0
   MOVLW 0xFE
   MOVWF 0x05
   CLRF 0x06
   BCF STATUS,RP0
   MOVLW 0xD0
   MOVWF 0x3A
   MOVLW 0x07
   MOVWF 0x3B
   MOVLW 0x02
   MOVWF 0x05
   CLRF 0x06
   MOVLW 0x05
   MOVWF 0x36
   MOVLW 0x08
   MOVWF 0x34
   MOVLW 0x6E
   MOVWF 0x22
   MOVLW 0x05
   CALL L27
   MOVLW 0x30
   MOVWF 0x38
   MOVLW 0x75
   MOVWF 0x39
L34:   BSF 0x05,0
   BSF STATUS,RP0
   BCF 0x05,0
   MOVLW 0x0A
   BCF STATUS,RP0
   CALL L28
   BCF 0x05,0
   BSF STATUS,RP0
   BCF 0x05,0
   BCF STATUS,RP0
   MOVLW 0x80
   MOVWF 0x38
   MOVLW 0x3E
   MOVWF 0x39
L32:   MOVF 0x38,W
   MOVWF 0x20
   MOVF 0x39,W
   MOVWF 0x21
   MOVLW 0xD6
   MOVWF 0x23
   MOVLW 0xD8
   CALL L29
   BTFSS STATUS,Z
   GOTO L30
   MOVLW 0x7F
   MOVWF 0x28
   MOVF 0x38,W
   MOVWF 0x22
   MOVF 0x39,W
   MOVWF 0x23
   MOVLW 0x01
   CALL L31
   MOVLW 0x0A
   CALL L28
   MOVLW 0xF4
   ADDWF 0x38,F
   MOVLW 0x01
   BTFSC STATUS,C
   ADDLW 0x01
   BTFSC STATUS,C
   GOTO L30
   ADDWF 0x39,F
   BTFSS STATUS,C
   GOTO L32
L30:   CLRWDT
   BTFSS 0x05,1
   GOTO L33
   GOTO L34
L33:   MOVLW 0x80
   MOVWF 0x38
   MOVLW 0x3E
   MOVWF 0x39
L36:   MOVF 0x38,W
   MOVWF 0x20
   MOVF 0x39,W
   MOVWF 0x21
   MOVLW 0xD6
   MOVWF 0x23
   MOVLW 0xD8
   CALL L29
   BTFSS STATUS,Z
   GOTO L35
   MOVLW 0x7F
   MOVWF 0x28
   MOVF 0x38,W
   MOVWF 0x22
   MOVF 0x39,W
   MOVWF 0x23
   MOVLW 0x01
   CALL L31
   MOVLW 0xC8
   CALL L28
   MOVLW 0xE8
   ADDWF 0x38,F
   MOVLW 0x03
   BTFSC STATUS,C
   ADDLW 0x01
   BTFSC STATUS,C
   GOTO L35
   ADDWF 0x39,F
   BTFSS STATUS,C
   GOTO L36
L35:   MOVLW 0x01
   MOVWF 0x3F
L41:   MOVLW 0x01
   MOVWF 0x3E
L40:   CLRWDT
   MOVF 0x3E,W
   SUBWF 0x3F,W
   BTFSS STATUS,C
   GOTO L37
   MOVLW 0xF0
   MOVWF 0x06
   GOTO L38
L37:   MOVLW 0x0F
   MOVWF 0x06
L38:   MOVLW 0x0A
   CALL L39
   INCFSZ 0x3E,F
   GOTO L40
   INCFSZ 0x3F,F
   GOTO L41
   MOVLW 0x64
   CALL L28
   MOVLW 0xFF
   MOVWF 0x3F
L46:   CLRWDT
   MOVLW 0x01
   SUBWF 0x3F,W
   BTFSS STATUS,C
   GOTO L42
   MOVLW 0x01
   MOVWF 0x3E
L45:   CLRWDT
   MOVF 0x3E,W
   SUBWF 0x3F,W
   BTFSS STATUS,C
   GOTO L43
   MOVLW 0xF0
   MOVWF 0x06
   GOTO L44
L43:   MOVLW 0x0F
   MOVWF 0x06
L44:   MOVLW 0x0A
   CALL L39
   INCFSZ 0x3E,F
   GOTO L45
   MOVLW 0x01
   SUBWF 0x3F,F
   BTFSC STATUS,C
   GOTO L46
L42:   MOVLW 0x64
   CALL L28
   MOVLW 0x01
   MOVWF 0x3F
L50:   MOVLW 0x01
   MOVWF 0x3E
L49:   CLRWDT
   MOVF 0x3E,W
   SUBWF 0x3F,W
   BTFSS STATUS,C
   GOTO L47
   MOVLW 0xF0
   MOVWF 0x06
   GOTO L48
L47:   MOVLW 0x0F
   MOVWF 0x06
L48:   MOVLW 0x0A
   CALL L39
   INCFSZ 0x3E,F
   GOTO L49
   INCFSZ 0x3F,F
   GOTO L50
   MOVLW 0x64
   CALL L28
   MOVLW 0xFF
   MOVWF 0x3F
L55:   CLRWDT
   MOVLW 0x01
   SUBWF 0x3F,W
   BTFSS STATUS,C
   GOTO L51
   MOVLW 0x01
   MOVWF 0x3E
L54:   CLRWDT
   MOVF 0x3E,W
   SUBWF 0x3F,W
   BTFSS STATUS,C
   GOTO L52
   MOVLW 0xF0
   MOVWF 0x06
   GOTO L53
L52:   MOVLW 0x0F
   MOVWF 0x06
L53:   MOVLW 0x0A
   CALL L39
   INCFSZ 0x3E,F
   GOTO L54
   MOVLW 0x01
   SUBWF 0x3F,F
   BTFSC STATUS,C
   GOTO L55
L51:   MOVLW 0x64
   CALL L28
   GOTO L34
L56:   SLEEP
   GOTO L56
A tad more work than I need right now, But someone here may run through..
 
ERGOYE,
You provide far too little information. You did not even say what the item you are building is supposed to do. You do not say what the LED is supposed to indicate. In your last thread about programming a PIC16F84 a solution was provided which was to use a PIC16F84A which you could have programmed using the PICKIT2 (Or 3) which you had. You would not explain why you would not use this solution. When you said that some software (I think it was the EPE programmer.) would not work with your version of windows but you did not say what version that was. (It could have been anything from Windows 3.1 to Windows10.) I have just noticed that Ian has gone to the trouble to disassemble the .HEX file. We should not have to reverse engineer the .HEX file to find out what the thing is supposed to do. I am not prepared to put the effort into working out what it is designed to do as you put so little effort into helping the people that are trying to help you. Just one point for the other members helping. I did open the .RAR file but it did not contain the missing .mac and .lib files.

Les.
 
I just simulated the hex file.... Working as follows:-

Mode switch + Led 1 blinks once a second.. Frequency 40khz ( ish)
Mode switch - Led 2 comes on at max frequency.. Frequency oscillating from 22khz to 60khz
 
Its the same hex file as one you posted!!!!
Know one did nothing to it.
 
Last edited:
No doubt Ian has a magic touch.

Sometimes all a person needs is encouragement to try again. That is "not nothing." It is something.
 
Last time I heard about a critter repeller it ran to something like 40 pages even though I posted working code on page two. (MR DEB).

Mike.
 
Not a thread to learn anything valid, really. Wasted my time.
 
Guys you are right ...what my mistake was on the pcb the instruction the way i have to install the LED was wrong direction.....that is. Why the out put gives me the necessary frequencies But the LED blink was absent. So what i did was...when Ian tells me that he simulated that and it works ...then dirrectly i reverse both LED and installed ...then..BINGO....

Again thank you Ian and all Friends.
 
;Hulda Clark Virus Zapper program
;for PIC16F84: osc=XT, wdt=OFF, put=ON.
;Andy Flind, 21/06/2001

#DEFINE PAGE0 BCF STATUS,5
#DEFINE PAGE1 BSF STATUS,5

STATUS: .EQU $03 ;general equates
PORTA: .EQU $05
TRISA: .EQU $05
PORTB: .EQU $06
TRISB: .EQU $06
F: .EQU $01
CTR0: .EQU $0C
CTR1: .EQU $0D
CTR2: .EQU $10
CTR3: .EQU $11
CTR4: .EQU $12

.ORG $0004
.ORG $0005

;initialise the system for operation
CLRF PORTA
CLRF PORTB
PAGE1
MOVLW %11110001 ;RA1,2,3 outputs
MOVWF TRISA
MOVLW %11000111 ;only RB3,4, and 5 outputs
MOVWF TRISB
PAGE0
MOVLW 255
MOVWF PORTA ;sets all high, for LEDs off
MOVLW %00100000 ;RB5 high, rest low
MOVWF PORTB

;main program sequence
CALL BLEEP
CALL FLASH
CALL BLEEP
CALL TRT
CALL BLEEP
CALL WAIT
CALL BLEEP
CALL FLASH
CALL BLEEP
CALL TRT
CALL BLEEP
CALL WAIT
CALL BLEEP
CALL FLASH
CALL BLEEP
CALL TRT
CALL FNSH

;Bleeper, 1/2 second bleep at 4kHz for piezo sounder, yellow LED on
BLEEP: BCF PORTA,2 ;yellow LED on
MOVLW 8 ;initialise for 2000 half cycles,
MOVWF CTR0 ;1/4 second total with 8
MOVLW 250 ;or 1/2 second with 16 etc
MOVWF CTR1
BLP1: MOVLW 8 ;change state of RB3
XORWF PORTB,F
BSF PORTA,3 ;battery check
BTFSS PORTB,0
BCF PORTA,3
MOVLW 36 ;timing to get exactly 125 uS half cycles
MOVWF CTR2
BLP2: DECFSZ CTR2,F
GOTO BLP2
NOP
NOP
DECFSZ CTR1,F ;counter, always takes 9 instruction cycles
GOTO BLP3
MOVLW 250
MOVWF CTR1
DECFSZ CTR0,F
GOTO BLP4
BSF PORTA,2 ;yellow LED off
RETURN
BLP3: NOP
NOP
NOP
NOP
BLP4: GOTO BLP1

;30 seconds of 1 second yellow LED flashes, 50% duty cycle
FLASH: MOVLW 60 ;60 half cycles, 30 seconds
MOVWF CTR0
FLSH1: MOVLW 4 ;change state of RA2
XORWF PORTA,F
MOVLW 79 ;30 second delay
MOVWF CTR1
FLSH2: MOVLW 25
MOVWF CTR2
FLSH3: MOVLW 83
MOVWF CTR3
FLSH4: DECFSZ CTR3,F
GOTO FLSH4
DECFSZ CTR2,F
GOTO FLSH3
DECFSZ CTR1,F
GOTO FLSH2
BSF PORTA,3 ;battery test
BTFSS PORTB,0
BCF PORTA,3
DECFSZ CTR0,F ;cycle counter
GOTO FLSH1
RETURN

;Treatment routine, 7 minutes of 2.5kHz output, yellow LED on
TRT: BCF PORTA,2 ;yellow LED on
MOVLW 48 ;initialise counter for 2.1 million half cycles
MOVWF CTR0
MOVLW 175
MOVWF CTR1
MOVLW 250
MOVWF CTR2
TRT1: MOVLW 48 ;change state of RB4 and RB5
XORWF PORTB,F
BSF PORTA,3 ;battery test
BTFSS PORTB,0
BCF PORTA,3
MOVLW 60 ;timing to exactly 200uS for half cycle
MOVWF CTR4
TRT2: DECFSZ CTR4,F
GOTO TRT2
NOP
DECFSZ CTR2,F ;counter takes exactly 13 instruction cycles
GOTO TRT3 ;regardless of zero skips
MOVLW 250
MOVWF CTR2
DECFSZ CTR1,F
GOTO TRT4
MOVLW 175
MOVWF CTR1
DECFSZ CTR0,F
GOTO TRT5
BSF PORTA,2 ;yellow LED off
RETURN
TRT3: NOP
NOP
NOP
NOP
TRT4: NOP
NOP
NOP
NOP
TRT5: GOTO TRT1

;Wait routine, for 28 mins, batt test every 30 seconds, green LED on
WAIT: BCF PORTA,1 ;green LED on
MOVLW 56 ;56 for a 28 minute period
MOVWF CTR4
WT1: MOVLW 229 ;these values give error of -4.312mS
MOVWF CTR0 ;over 28 minutes!
WT2: MOVLW 200
MOVWF CTR1
WT3: MOVLW 217
MOVWF CTR2
WT4: DECFSZ CTR2,F
GOTO WT4
DECFSZ CTR1,F
GOTO WT3
DECFSZ CTR0,F
GOTO WT2
BSF PORTA,3 ;Battery check
BTFSS PORTB,0
BCF PORTA,3
DECFSZ CTR4,F
GOTO WT1
BSF PORTA,1 ;green LED off
RETURN

;Finish routine, bleeps every ten seconds, green LED on
FNSH: BCF PORTA,1 ;green LED on
FIN1: CALL BLEEP
MOVLW 59 ;use 59 with 1/4 sec bleep, 105 with 1/2
MOVWF CTR0
FIN2: MOVLW 250 ;use 250 with 1/4 sec bleep, 172 with 1/2
MOVWF CTR1
FIN3: MOVLW 219 ;use 219 with 1/4 sec bleep, 174 with 1/2
MOVWF CTR2
FIN4: DECFSZ CTR2,F
GOTO FIN4
DECFSZ CTR1,F
GOTO FIN3
DECFSZ CTR0,F
GOTO FIN2
GOTO FIN1

.END
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top