欢迎访问ic37.com |
会员登录 免费注册
发布采购

AN1950 参数 Datasheet PDF下载

AN1950图片预览
型号: AN1950
PDF下载: 下载PDF文件 查看货源
内容描述: 水位监测 [Water Level Monitoring]
分类和应用: 监控
文件页数/大小: 24 页 / 298 K
品牌: FREESCALE [ Freescale ]
 浏览型号AN1950的Datasheet PDF文件第16页浏览型号AN1950的Datasheet PDF文件第17页浏览型号AN1950的Datasheet PDF文件第18页浏览型号AN1950的Datasheet PDF文件第19页浏览型号AN1950的Datasheet PDF文件第21页浏览型号AN1950的Datasheet PDF文件第22页浏览型号AN1950的Datasheet PDF文件第23页浏览型号AN1950的Datasheet PDF文件第24页  
;
;
delmain: main delay routine; generates delay equal to H:X x 20us  
-------  
delmain: mov #$36,tsc  
sthx tmodh  
;stop TIM & / 64  
;count H:X x 20us  
bclr 5,tsc  
;start clock  
delwait: brclr 7,tsc,delwait ;wait for end of countdown  
pulx  
pulh  
rts  
;this RTS serves for all delay routines!  
;-------- A/D Routines ----------------------------------------------  
;
;
adcbyti: gets single A/D reading from PTA0 and returns it in A  
-------  
adcbyti: mov #$00,adscr ;ADC set to PTA0  
brclr 7,adscr,*  
lda adr  
rts  
;wait for ADC reading  
;result in adr  
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
;
;
adcbyta: gets averaged A/D reading from PTA0 and returns it in A  
-------  
adcbyta: clr CNT  
clr RB  
;average 256 readings  
;will be addint them up  
;in RB:RA  
clr RA  
do256a: bsr adcbyti  
add RA  
sta RA  
lda RB  
adc #$00  
sta RB  
;16-bit add into RB:RA  
dbnz CNT,do256a ;do all 256  
lsl RA  
bcc nochga  
inc RB  
;if RA<$80  
;then RB result is correctly rounded  
;otherwise round off to next value  
nochga: lda RB  
rts  
;-------- LCD Routines ----------------------------------------------  
;
;
lcdinit: initializes LCD  
-------  
lcdinit: lda #$3C  
bsr lcdcmdo  
lda #$0C  
;set 8-bit interface, 1/16 duty, 5x10 dots  
;display on, cursor off, blink off  
;increment cursor position, no display shift  
;clear display  
bsr lcdcmdo  
lda #$06  
bsr lcdcmdo  
lda #$01  
bsr lcdcmdo  
rts  
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
;
;
lcdcmdo: sends a command to LCD  
-------  
lcdcmdo: bsr shiftA  
bclr 4,porta  
bset 3,porta  
bclr 3,porta  
bsr del5ms  
rts  
;RS=0 for command  
;toggle E  
;some commands require 2ms for LCD to execute  
;so let's play it safe  
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
;
;
lcdchro: sends a character (data) to LCD  
-------  
lcdchro: bsr shiftA  
bset 4,porta  
;RS=1 for data  
AN1950  
20  
Sensors  
Freescale Semiconductor  
 复制成功!