Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions