Total members 11884 |It is currently Sun Sep 24, 2023 8:48 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Writing a counter to a PORT
Code:

TITLE 
"Write Count to Port D"
list p = 16f877
include 
<p16f877.inc>
DELAY_VHI EQU H'30'
DELAY_HI EQU H'31'
DELAY_LO EQU H'32'
COUNT EQU H'33'
ORG H'00'
NOP
GOTO START 

ORG 0x20
START BCF STATUS
,RP0; BANK 0
CLRF PORTD
; INITALIZE PORTC BY CLEARING OUTPUT

DATA LATCHES
BSF STATUS
,RP0; SELECT BANK1
MOVLW 0X00
;W REG=00
MOVWF TRISD
;SET RD AS OUTPUTS
BCF STATUS
,RP0; BANK 0
CLRF COUNT
; COUNT = 0 

MAIN MOVF COUNT
,W; GET COUNT
MOVWF PORTD
; OUTPUT W REG TO PORTD
CALL DELAY
CALL DELAY
INCF COUNT
; COUNT= COUNT+1
GOTO MAIN

 
; SUBRoUTINES
DELAY  
MOVLW 0X01
MOVWF DELAY_LO
MOVLW 0XA1
MOVWF DELAY_HI
MOVLW 0XFF
MOVWF DELAY_VHI

BIG
OUTER
INNER

INCFSZ DELAY_LO
,1
GOTO INNER
INCFSZ DELAY_HI
,1
GOTO OUTER
INCFSZ DELAY_VHI
GOTO INNER
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 : Writing a Counter to any PORT
 C++ help with writing a program.     -  
 Reading and Writing To text file     -  
 Read XML file content using SAX and writing its as SQL     -  
 Writing a Windows Form Application For .NET Framework Using     -  
 jsp page counter     -  
 reset the list counter     -  
 File page counter in php     -  
 Use cookie to create page counter     -  
 Use cookie to create page counter     -  
 ramp Counter ANALOGUE TO DIGITAL CONVERSION (ADC)     -  



cron





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