投稿募集! スレッド一覧

スレッド作成 他のスレッドを探す

[PR]  グアム格安旅行 求人・転職 seo対策 CIA
teacup. ] [ 無料掲示板 ] [ プレミアム掲示板 ] [ teacup.コミュニティ ] [ ブログ ] [ チャット ]

新着順:3/87 記事一覧表示 | 《前のページ | 次のページ》

FJCニュ−ス10月号-2

 投稿者:ty  投稿日:2009年 9月30日(水)18時04分10秒
  通報
  FJCニュ−ス10月号-2
;ーーーーーーーーーーーーーーーーーーーーーー
mov !rb,#00000000b ; DB7-DB0ピンをOUTに
clr ra
clr rb
clrb gie
setb txd
call init_lcd ; LCD初期化
main mov ch,#'T' ;ロジックデータ送信要求
call transmit
call receive
mov rxdt,ch

dsp_11
clrb RS
mov rb,#10000000b+64
call write_lcd8 ; カーソルを2行目に移動
setb RS
mov cn,#31h
dsp_2 mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#2
call onoff

mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#4
call onoff

mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#8
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#10h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#20h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#40h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#80h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#1
call onoff

goto main
;---------- sub ------------------
onoff cje ch,#0,offd
mov rb,#'H'
onoff1 call write_lcd8
ret
offd mov rb,#'L'
goto onoff1
; 液晶初期化ルーチン
init_lcd
mov wait_cn,#15 ; wait 15ms
call wait_ms

clrb RS ; RS='L'
mov rb,#00110000b
call write_lcd8
mov wait_cn,#5 ; wait 4.1ms
call wait_ms

mov rb,#00110000b
call write_lcd8
mov wait_cn,#100 ; wait 100us
call wait_us

mov rb,#00110000b
call write_lcd8 ; 0 0 0011 (3)

mov rb,#00111000b
call write_lcd8 ; 0 0 0010 (8bit)
;
mov rb,#00001000b ; duty,font set9
call write_lcd8

mov rb,#00000001b ; クリアコマンド
call write_lcd8
mov wait_cn,#2 ; クリアが終わるまで待つ
call wait_ms

mov rb,#00000110b ; entry mode set
call write_lcd8

mov rb,#00001110b ; display on,cursor on
call write_lcd8
ret

; 8ビットモード専用液晶ライトルーチン
write_lcd8 nop
nop
nop
setb E ; Eピンを'H'
nop
clrb E

mov wait_cn,#40
call wait_us
ret
;----------- LCD clr cursol top ---------
lcd_top clrb RS

mov rb,#00000001b ; クリアコマンド
call write_lcd8
mov wait_cn,#2 ; クリアが終わるまで待つ
call wait_ms
mov rb,#10000000b
call write_lcd8 ; カーソルを1行目に移動
setb RS
ret

; msオーダーのウェイト
wait_ms
wait_ms0
mov wait_cn2,#0
wait_ms1
nop
nop
nop
nop
nop
nop
nop
djnz wait_cn2,wait_ms1
djnz wait_cn,wait_ms0
ret

; μsオーダーのウェイト
wait_us
wait_us0
djnz wait_cn,wait_us0
ret

; RS232C送信サブルーチン
;
transmit bcf txd
mov rs,#btime
trans10 djnz rs,trans10
mov cn,#8
nop
transmit0 rr ch
nop
movb txd,c ; データ出力(LSBから)

mov rs,#btime
trans11 djnz rs,trans11

djnz cn,transmit0
nop
nop
nop
nop
nop
nop
bsf txd
mov rs,#btime
trans12 djnz rs,trans12 ; STOPビット分ウェイト
ret


; RS232C受信サブルーチン
receive btfss  rxd
goto receive
receivew
btfsc rxd
goto receivew ; STARTビットがくるまで待つ

mov rs,#btime/2 ; 1/2ビット分待つ
recv10 djnz rs,recv10
mov cn,#8
nop

recv0
mov rs,#btime
recv11 djnz rs,recv11
nop

movb c,rxd ; データ入力
rr ch

djnz cn,recv0
ret

http://homepage2.nifty.com/JG1FJC/

 
》記事一覧表示

新着順:3/87 《前のページ | 次のページ》
/87