Question: I need to convert this assembly code into C. This is for the chip: PIC18f1220, thank you p=18F1220 hex WDT=OFF, LVP=OFF, PORTA PORTE TRISA TRISB

I need to convert this assembly code into C. This is for the chip: PIC18f1220, thank you

I need to convert this assembly code into C. This is for

the chip: PIC18f1220, thank you p=18F1220 hex WDT=OFF, LVP=OFF, PORTA PORTE TRISA

p=18F1220 hex WDT=OFF, LVP=OFF, PORTA PORTE TRISA TRISB ADCONL list radix config ; Set proces3or type : Sets the default radix for data exp. OSC OxFBO 0xF81 OxF92 0xF93 OxFC1 INT 102 :Disable Watchdog timer, Low V. Prog, and RA6 as a clock = define #de f i ne #de fine tdefine #define 13 17 COUNT LASTIN INPUT TEMP 0x080 0x081 0x082 0x083 equ equ org 0x000 ; Set the program origin (start) to absolute 0x000 Initialize all I/o port:s CLRE CLRF MOVLW PORTB 0x7F ADCON1 0x00 TRISB : Initialize PORTB ; Set all A/D Converter Pins as ; digital I/o pina : Value used to initialize data direction : Set Port B RB as outputs ; Value used to initialize data direction ; Set Port A Pin 0 RA as input MOVLW 30 MOVLW TRISA 0x00 COUNT LASTIN MOVLW : COUNTWREG ; LAST IN -WREG MOVWE 35 Loop: MOVE XORWE ANDLW PORTA, INPUT INPUT, 0 LASTIN, O INPUTPORTA ; W- PORTA 40 W-W ANDSS 0x1 42 INPUT, LAST IN ; LASTIN=PORTA TEMP TEMP, 0 IncL LOop TEMP- ; If TEMP = 0 Then Skip Next Command MOVWE BTFSC CALL GOTO 48 4 9 50 IncL: MOVE COUNT, 0 :WCOUNT ADDLW ; COUNT = W ; PORTB =w COUNT 52 PORTB

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!