Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ASM for Pic 16F84 to C

Status
Not open for further replies.

node

Newbie level 5
Newbie level 5
Joined
Jan 25, 2005
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
97
Can anyone convert this Pic 16F84 asm code and put it into C language.



; Generated by WinPicProg 1.91, (c) Nigel Goodwin 2002.

LIST P=16F84, F=INHX8M
include "P16F84.inc"
__CONFIG 0x3FFF

ORG 0x0000

MOVLW 0xFA
CALL Label_0001
MOVLW 0x80
CALL Label_0001
CLRF PORTA
ADDLW 0x7F
OPTION
MOVLW 0xFF
TRIS PORTB
TRIS PORTA
CLRF 0x20
BSF 0x20 , 02
Label_0004 CALL Label_0002
CALL Label_0003
BSF 0x20 , 02
BTFSC PORTB , 01
BCF 0x20 , 02
GOTO Label_0004
Label_0003 MOVWF 0x2A
CLRF 0x2B
COMF 0x2A , f
MOVLW 0x08
MOVWF 0x28
BSF PORTB , 00
MOVLW 0xFE
TRIS PORTB
BCF PORTB , 00
MOVF PORTB , W
RLF 0x2B , f
NOP
NOP
Label_0005 NOP
NOP
ANDLW 0xFE
BTFSC 0x2A , 07
IORLW 0x01
MOVWF PORTB
RLF 0x2A , f
DECFSZ 0x28 , f
GOTO Label_0005
NOP
NOP
NOP
NOP
NOP
NOP
BSF PORTB , 00
RETURN
Label_0002 MOVLW 0x09
MOVWF 0x28
BTFSC 0x20 , 02
GOTO Label_0006
Label_0007 BTFSS PORTA , 00
GOTO Label_0007
Label_0008 BTFSC PORTA , 00
GOTO Label_0008
MOVLW 0x05
CALL Label_0001
Label_0009 MOVLW 0x03
CALL Label_0001
NOP
NOP
BCF STATUS , C
BTFSS PORTA , 00
BSF STATUS , C
RLF 0x2A , f
DECFSZ 0x28 , f
GOTO Label_0009
RRF 0x2A , f
MOVF 0x2A , W
MOVWF 0x30
RETURN
Label_0006 BTFSS PORTA , 00
GOTO Label_0006
Label_000A BTFSC PORTA , 00
GOTO Label_000A
MOVLW 0x0D
CALL Label_0001
Label_000B MOVLW 0x0A
CALL Label_0001
NOP
NOP
BCF STATUS , C
BTFSS PORTA , 00
BSF STATUS , C
RLF 0x2A , f
DECFSZ 0x28 , f
GOTO Label_000B
RRF 0x2A , f
MOVF 0x2A , W
MOVWF 0x30
RETURN
Label_0001 MOVWF 0x29
Label_000C DECFSZ 0x29 , f
GOTO Label_000C
RETLW 0x00



END
 

The easiest way:

#asm

.. your code

#endasm

Regards,
IanP
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top