Total members 11894 |It is currently Sat Nov 23, 2024 4:33 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





ramp Counter ANALOGUE TO DIGITAL CONVERSION (ADC)
Code:
list 16f877
include <p16f877.inc>
BANK0 macro
bcf STATUS
,RP0
bcf STATUS
,RP1
endm

BANK1 macro
bsf STATUS
,RP0
bcf STATUS
,RP1
endm

BANK2 macro
bcf STATUS
,RP0
bsf STATUS
,RP1
endm

BANK3 macro
bsf STATUS
,RP0
bsf STATUS
,RP1
endm

COUNT EQU 0x22 
;USED FOR COUNTING
RESULT EQU 0x23


ORG 0
NOP
GOTO START
ORG 0x20

START CALL INIT
REPEAT CLRF COUNT 
;SET COUNT TO ZERO
RAMP MOVF COUNT
,;GET COUNT vALUE
MOVWF PORTD 
;AND OUTPUT TO DAC
BTFSC PORTA
,;TEST COMP OUTPUT
GOTO DONE 
;IF NOT ZERo
CoNVERS ION CoMPLETE
INCF COUNT 
;COtINT UP
GOTO RAMP 
;RAMP UP

DONE MOVF COUNT
,;GET COUNT
MOVWF RESULT 
;AND STORE
GOTO REPEAT 
;DO AGAIN

;PORT INIT ROUTINE
INIT BSF STATUS
,RP0 ;SET To BANK 1.
CLRF TRISD 
;SET PORT D To OUTPUT
MOVLW 06 
;MAKE PoRT A DIGITAL
MOVWF ADCON1
BSF TRISA
,;AND BIT A4 To INPUT
BCF STATUS
,RP0 ;BACK To BANK 0
RETURN
END




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : ramp Counter ANALOGUE TO DIGITAL CONVERSION (ADC)
 SUCCESSIVE APPROXIMATION ANALOGUE TO DIGITAL CONVERSION     -  
 The Digital to Analogue converter DAC writer     -  
 digital watermark on image     -  
 .dll conversion     -  
 Type Conversion     -  
 Number Conversion     -  
 please get me the following Delphi to Java conversion     -  
 jsp page counter     -  
 File page counter in php     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com