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.

Explain the below assembly program for pic

Status
Not open for further replies.

rangerskm

Full Member level 4
Full Member level 4
Joined
Jan 23, 2013
Messages
199
Helped
0
Reputation
2
Reaction score
0
Trophy points
1,296
Activity points
2,663
Code:
    #include"p16f73.inc"
    org 0x00
    bsf status,rp0
    movlw 0xff
    movwf trisa
    clrf trisb
l1: Bcf status,rp0
    movlw 0x05
    movwf adcon0
    btfsc adcon0,2
    goto $-1
    movf adres,0
    movwf portb
    goto l1
    end

this may be an adc program explain the program with the help of the adc sfrs
 

this may be an adc program explain the program with the help of the adc sfrs[/QUOTE]


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
#include"p16f73.inc"
    org 0x00
 
    bsf status,rp0          //for selecting 
                            //RAM addresses 80h-ffh by default
    
    movlw 0xff              //for selecting 
 
    movwf trisa             //port A an input port
 
    clrf trisb              //making port B an output port
 
l1: Bcf status,rp0          //for selecting 
                            //RAM addresses 00h-7fh by default
 
    movlw 0x05              //Turning ON the ADC
                            //however i think 0x01 could do the job too.
                            //here you are assigning 1 to the GO bit in the 
    movwf ADCON0            //ADCON0 which is not necessary
        
    btfsc adcon0,2          //Checking the status of DONE bit in ADCON0 (0 means ADC is
                            //has completed the conversion operation)
 
    goto $-1                // this should be l1. this will keep the control to the upper block
                            // of code until conversion is complete
 
    movf adres,0            // Move the contents of ADRES (converted data) register to 
                            // WREG (workign register)
 
    movwf portb             //Send the converted data from WREG to PORTB
 
    goto l1                 // Keep looping back to the upper block of code for
                            // next analog signal to be converted
    end

 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top