Optik hız ölçer

Başlatan taless, 27 Nisan 2006, 01:04:32

taless

arkadaşlar pic 16f877 ile optik hız ölçer yapmak istiyorum. yapmak istediğim şey tam olarak şöyle.
iki tane giriş butonu koyucam.bu giriş butonlarından ilkine basıldığında pic içerisindeki timer saymaya başlayacak.ikinci butona bastığım zaman ise timer duracak.ayrıca koyduğum iki giriş butonu ile(bunu aşağı yukarı sayıcı mantığı olarak düşünebiliriz)3 adet displaye bir değer yazdırıp bu değeri bir butonla hafızaya alıcam.ve bu hafızaya aldığım değerle timer da elde ettiğim değeri bölüp sonucu displayde görücem.timerde elde ettiğim değerin birimini mikrosaniye hafızaya aldığım değerin birimini ise cm olarak kabul edip bölüm sonucunu displayde km/saat olarak görmek istiyorum.bununla ilgili program yardımına ihtiyacım var. arkadaşlar yardımınızı bekliyorum...

Mod Notu: Başlığınız konuya uygun olarak değiştirilmiştir. Biraz daha dikkatli olalım.  

ismetelk

16 bitlik tmr1 sayıcısını kullnarak sayma işlemini yasparsın 1. butona basıp sonrada diğer butona basma işi en azında saniye mertebesinde olacaktır.( tabi max ve min. surelerini bilmek lazım. şimdi)
buda senin ekstra birkaç sayaç belirleyip onlarıda artırarak işin sonunda onları okuman demektir.
ayrıca 877 kullanıcaksan kendin gireceğin sayı için tuş takımı kullan derim. 3x4 tuş takımında artan iki tuşun biirini enter olarak kullanıp bolme işlemini onla yaptırabilirsin diğerininde delete olarak kullanırsın. tuş takımı kullanmıycaksan 16f628 le işini halledebilirsin sanırım.
kolay gelsin

Erol YILMAZ

Konunun birden çok yerde açılması takibiin zorlaştırıyor.
Tek bir noktada olması hem bulunabilirlik açısından hem de database açısından iyi olur.
Şimdi sizin sorunun cevabına gelelim.
Midrane Reference Manual da Capture ile ilgili bir püf noktası vermişler.
Aslında buna benzer birşey bana da lazımdı. Yaptım, önemli bir ayrıntının nasıl çalıştığını anlayamıyordum, sayende onu da öğrenmiş oldum. :D



Pic için hangi programlama dilini kullanıyorsunuz ? yada kullanacaksınız ?

taless

teşekkürlererol hocam.
programı tam olarak buldum.devreside tamam fakat bir sorun var.proteusta devreyi kurup çalıştırdığım zaman bir hata ile karşılaşıyorum.sorunun ne olduğunu tam olarak çözemedim.HATA MESAJI ŞÖYLE:
SIMULATION LOG
==============
Design:   C:\PROTEUS\PROTEUS - PROGRAMLARI\DENEME.DSN
Doc. no.: <NONE>
Revision: <NONE>
Author:   <NONE>
Created:  17/02/05
Modified: 27/04/06

Compiling source files...
Build completed OK.
Compiling netlist...
Linking netlist...
Partition analysis...

Simulating partition 1 [7B4228CE]...
Animation started sucessfully...
PROSPICE Release 6.2 SP0 (C) Labcenter Electronics 1993-2002.
SPICE Kernel Version 3f5. (C) Berkeley University ERL.

Reading netlist...
Net VDD taken as alias for VCC
Net VSS taken as alias for GND
Reading SPICE models...
Building circuit...
Instantiating SPICE models...
[U1] PIC16 model release 6.01.00 simulating PIC1684 device.
[U1] Loaded 64 bytes of persistent EEPROM data.
[U1] Loading HEX file '..\..\Documents and Settings\ARİSTOTALESS\Desktop\bitti\BBSPD14.HEX'.
FATAL: [U1] Program or EEPROM data has invalid address [4000] for this device

Real Time Simulation failed to start

Real Time Simulation FAILED.

PROGRAM İSE ŞU ŞEKİLDE YAZILMIŞ AMA NEDEN ÇALIŞMIYOR ANLAMDIM HENÜZ.PİC 16F84 KULLANIYORUM BU ARADA:
;
; 'e‘¬Œvƒ\[ƒX bb_speed.asm 1.4
;
; for PIC16F84@20MHz
;
; –{ƒvƒÂƒOƒ‰ƒ€‚̓gƒCƒKƒ"‚Å"­ŽÃ‹Â‚³‚ê‚éBB'e‚̏‰‘¬‚¨‚æ‚јAŽÃ‹Â‘¬"xԻ'èŠí—p‚Å‚·B
; ‚Ü‚½‚Ü‚½‚Ü‚½—á‚Ì‚²‚Æ‚­–{ƒ\[ƒX‚͏HŒŽÂ‚ÃŒPA.EXEŠg'£ƒCƒ"ƒXƒgƒ‰ƒNƒVƒ‡ƒ"‚ğŽg—p‚µ‚Ä
; ‚¨‚è‚Ü‚·‚Ì‚Å‚ ‚µ‚©‚炸B   2000.11 (c) RUU
;
; •ÏX—š—ğ
;      2002.04   (1.4) Ի'èÂ¸"x‚ÌŒüÃ£(ƒJƒEƒ"ƒgŽüŠú=1.8us‚ɕύX)
;      2002.02   (1.3) Ի'èÂ¸"x‚ÌŒüÃ£(ƒJƒEƒ"ƒgŽüŠú=3.2us‚ɕύX)
;      2002.02 (1.2) ˜AŽÃ‹Â‘¬"x‚Ì‘ª'è‹@"\'ljÁA‚»‚Ì‘¼‰ü—ǁB
;      2000.12 (1.1) ƒvƒŠƒXƒP[ƒ‰‚ğŽg—p‚µ‚ăJƒEƒ"ƒgŽüŠú‚ğ12.8us‚É‚·‚éB
;                 Â‚±‚ê‚É‚æ‚èTMR0Š„‚èžÂ‚İ‚ğ‚â‚ß‚Ämain"à‚ÅŒo‰ßŽžÂŠÃ”ƒJƒEƒ"ƒg‚ɕύXB
;      2000.11 (1.0) Ã…Â‰Â‚̃o[ƒWƒ‡ƒ"
;

         .include   16F84.h
         .osc      hs
         .wdt      off
         .pwrt      on
         .protect   off

PT1         equ      ra.3      ; "üŒû‘¤ƒtƒHƒgƒgƒ‰
PT2         equ      ra.4      ; oŒû‘¤

CNT_MIN      equ      45         ; Ã…'áƒJƒEƒ"ƒg'l = 45 (ŒvԻÃ…‘å 987m/s)
CNT_MAX0   equ      64         ; ˜AŽÃ‹ÂƒJƒEƒ"ƒgÃ…‘å(high byte) = 4000h(Ã…‘å 5.24•b)

WAIT_CNT   equ      162         ; 100us‚ÌwaitƒJƒEƒ"ƒg
BB_MIN      equ      10         ; BB'eÃ…'ád—Ê(=0.10g)
BB_MAX      equ      50         ; BB'eÃ…‘åd—Ê(=0.50g)
BB_CNT_MIN   equ      2         ; Ã…'á˜AŽÃ‹'e"
BB_CNT_MAX   equ      20         ; Ã…‘å˜AŽÃ‹'e"

         org      0ch

res         ds      1         ; ƒŠƒUƒ‹ƒgƒR[ƒh
SW2         equ      res.0      ;    Â•\ŽÂ¦Ã˜Â‚è‘ւ¦/UP
SW3         equ      res.1      ;    'ed—ÊSET/DOWN
SW1         equ      res.2      ;    RESET/OK

led_opt      ds      1         ; LED•\ŽÂ¦ÂƒIƒvƒVƒ‡ƒ" Šebit=1‚Å"_""
MSLED      equ      led_opt.0   ;    m/s•\ŽÂ¦
JLED      equ      led_opt.1   ;    J•\ŽÂ¦
P1         equ      led_opt.2   ;    Â¬""_1Œ…–Ú
P2         equ      led_opt.3   ;    Â¬""_2Œ…–Ú

bcdbuf      ds      5         ; BCD(10i)Ši"[ƒGƒŠƒA 5bytes
disp_buf   ds      1         ; •\ŽÂ¦Â—pƒoƒbƒtƒ@
keta_cnt   ds      1         ; •\ŽÂ¦ÂŒÂ…ƒJƒEƒ"ƒ^
count      ds      2         ; PT1-PT2'ʉߎžÂŠÃ”ƒJƒEƒ"ƒ^(16bit)
work      ds      1         ; ˆêŽžŽg—pƒ[ƒN
cnt         ds      1         ; 32bit‰‰ŽZ‚¨‚æ‚Ñwait—pƒJƒEƒ"ƒ^
xd64      ds      4         ; 64bit‰‰ŽZ—p(xd64+xd32=64bit)
xd32      ds      4         ; 32bit‰‰ŽZ—p
xs32      ds      4         ; V
y32         ds      4         ; V
bb_weight   ds      1         ; BB'ed—Ê(*100g)
bb_cnt_num   ds      1         ; ˜AŽÃ‹Â‘ª'è'e"
bb_cnt      ds      1         ; ˜AŽÃ‹'e"ƒJƒEƒ"ƒ^
wsave      ds      1         ; WƒŒƒWƒXƒ^‘Ş"ğ
stsave      ds      1         ; STATUS‘Ş"ğ

         eeorg   0
         eedata   25,10      ; EEPROMÂ‰ÂŠÃº'l(BB'ed—Ê=0.25g, ˜AŽÃ‹Â‘ª'è'e"=10)
         eedata   'BB_Speed 1.4 by RUU -- http://www.mars.dti.ne.jp/~ogura/'

         org      0
         goto   main
         org      4
         goto   intproc

;;;;;;;;;;;; Š„‚èžÂ‚İÂˆÂ— intproc  ;;;;;;;;;;;;
intproc                                 ; ˜AŽÃ‹Â‘¬"xԻ'è‚̃JƒEƒ"ƒgƒAƒbƒv—pŠ„‚èžÂ‚İÂˆÂ—
         mov      wsave,w                  ; WƒŒƒWƒXƒ^‘Ş"ğ
         mov      stsave,status                  ; STATUS‘Ş"ğ

         sub      tmr0,#100 - 2            ; tmr0Ã„İ'è(3.2us*100=0.32msŠÔŠu‚ÅŠ„‚荞‚İ)
         clrb   t0if
         incsz   count[1]               ; ƒJƒEƒ"ƒgƒAƒbƒv
         goto   int_end
         inc      count[0]               ; High byte‚ÖŒ…Ã£Â‚ª‚è
int_end
         mov      status,stsave            ; STATUS–ß‚·
         mov      w,wsave                  ; W–ß‚·
         retfie                        ; •œ‹A

;;;;;;;;;;;; main ;;;;;;;;;;;;
main
         ;; Â‰ÂŠÃºÂ‰Â»
init
         ;; I/Oƒ|[ƒgİ'è
         mov      !ra,#00011000b            ; PT1,PT2‚ğIN‚ɁASEG1`3select‚ğOUT‚É
         mov      !rb,#00000111b            ; RB0`2(SW)‚ğ"ü—́ARB3,RB4`7(BCDo—Í)‚ğo—Í‚É
         clr      ra
         clr      rb

         ;; OPTIONƒŒƒWƒXƒ^İ'è
         setb   rp0
         mov      option,#00000011b         ; ƒ|[ƒgBƒvƒ‹ƒAƒbƒvAƒvƒŠƒXƒP[ƒ‰(1:16)
         clrb   rp0

         ;; Š„‚èžÂ‚İİ'è
         mov      intcon,#00100000b         ; ƒ^ƒCƒ}0Š„‚èžÂ‚İ‹–‰ÂAƒOƒ[ƒoƒ‹Š„‚èžÂ‚İ‹֮~

         ;; EEPROMƒf[ƒ^(BB'eŽÂ¿Â—Ê,˜AŽÃ‹Â‘ª'è'e")ƒ[ƒh
         clr      eeadr
         call   eeprom_read
         mov      bb_weight,eedata
         inc      eeadr
         call   eeprom_read
         mov      bb_cnt_num,eedata

         call   get_key                  ; SW1‚ğ‰Ÿ‚µ‚È‚ª‚ç"dŒ¹ON‚È‚ç˜AŽÃ‹Â‘ª'胂[ƒh‚Ö
         jb      SW1,mode_single

         ;; -------- ˜AŽÃ‹Â‘¬"xԻ'胂[ƒh --------
mode_series
         clr      count[0]               ; ƒJƒEƒ"ƒ^ƒNƒŠƒA
         clr      count[1]
         mov      bb_cnt,#1
         clr      res                     ; ƒŠƒUƒ‹ƒgƒR[ƒhƒNƒŠƒA
loop_0
         jnb      PT1,keychk_0            ; 'e"­ŽÃ‹?
         mov      tmr0,#155               ; TMR0Â‰ÂŠÃºİ'è(100ƒJƒEƒ"ƒg=0.32ms)
         setb   gie                     ; ƒOƒ[ƒoƒ‹Š„‚èžÂ‚İ‹–‰Â
         goto   strt_count_0            ; 'ʉߎžÂŠÃ”‚̃JƒEƒ"ƒgŠJŽn
keychk_0
         call   get_key                  ; SW3‚ª‰Ÿ‚³‚ꂽ‚ç˜AŽÃ‹"İ'è‚ğs‚¤
         jb      SW3,loop_0
         clrb   gie

wait_off_0
         call   get_key
         jnb      SW3,wait_off_0            ; SW3‚ª—£‚³‚ê‚é‚Ü‚Å‘Ò‚Â
         call   set_bb_count
         goto   mode_series

strt_count_0                           ; ˜AŽÃ‹"‚̃JƒEƒ"ƒg
         jb      PT2,next_loop            ; 'e‚Ì'ʉߑ҂¿
         cja      count[0],#CNT_MAX0,err_0   ; Œo‰ßŽžÂŠÃ”ƒ`ƒFƒbƒN
         goto   strt_count_0
next_loop
         jnb      PT1,chk_count_0            ; ŽÂŸÂ‚ÃŒ'e‘Ò‚¿
         inc      bb_cnt
         cje      bb_cnt,bb_cnt_num,end_count_0   ; Ի'è˜AŽÃ‹"‚É'B‚µ‚½‚çƒJƒEƒ"ƒgI—¹
         goto   strt_count_0

chk_count_0
         cja      count[0],#CNT_MAX0,err_0   ; Œo‰ßŽžÂŠÃ”ƒ`ƒFƒbƒN
         goto   next_loop

end_count_0
         ;; ˜AŽÃ‹Â‘¬"x("­/sec)•\ŽÂ¦
         clrb   gie

         clr      xd32[0]
         mov      xd32[1],#04h            ; xd32=312500
         mov      xd32[2],#0c4h
         mov      xd32[3],#0b4h

         clr      y32[0]                  ; y32=˜AŽÃ‹"
         clr      y32[1]
         clr      y32[2]
         mov      y32[3],bb_cnt_num

         call   mul64                  ; xd32=312500*˜AŽÃ‹"

         clr      y32[0]                  ; y32=count
         clr      y32[1]
         mov      y32[2],count[0]
         mov      y32[3],count[1]

         call   div32                  ; "­/sec(*100)=312500*˜AŽÃ‹"/count

         call   conv_bcd
         mov      fsr,#bcdbuf
         mov      led_opt,#1               ; 'PˆÊ="­/sec
         call   disp_num
         jnb      SW3,wait_off_0            ; SW3‚ª‰Ÿ‚³‚ꂽ‚ç˜AŽÃ‹"İ'è‚ğs‚¤
         goto   mode_series

err_0
         clrb   gie
         call   disp_err
         goto   mode_series


         ;; -------- 'P"­E'e‘¬‘ª'胂[ƒh --------
mode_single
         clr      count[0]               ; ƒJƒEƒ"ƒ^ƒNƒŠƒA
         clr      count[1]
         clr      res                     ; ƒŠƒUƒ‹ƒgƒR[ƒhƒNƒŠƒA

loop
         jb      PT1,strt_count            ; 'e"­ŽÃ‹?
keychk
         call   get_key                  ; SW3‚ª‰Ÿ‚³‚ꂽ‚çBB'ed—ʐİ'è‚ğs‚¤
         jb      SW3,loop

wait_off
         call   get_key
         jnb      SW3,wait_off            ; SW3‚ª—£‚³‚ê‚é‚Ü‚Å‘Ò‚Â
         call   set_weight
         goto   loop

strt_count                              ; 'ʉߎžÂŠÃ”‚̃JƒEƒ"ƒg
         jb      PT2,end_count            ; 2
         inc      count[1]               ; 1
         snz                           ; 1(2)
         inc      count[0]               ; 1
         snz                           ; 1(2)
         goto   err                     ; (1)   ÂƒJƒEƒ"ƒ^ƒI[ƒo[ƒtƒ[
         goto   strt_count               ; 2      ÂŒv9cycle=1.8us

end_count
         cjne   count[0],#0,disp_ms         ; ƒJƒEƒ"ƒg'l‚Ì"͈̓`ƒFƒbƒN
         cjb      count[1],#CNT_MIN,err

         ;; ‘¬"x(m/s)•\ŽÂ¦
disp_ms
         clr      xd32[0]                  ; xd32=4444444
         mov      xd32[1],#043h
         mov      xd32[2],#0d1h
         mov      xd32[3],#01ch

         clr      y32[0]                  ; y32=count
         clr      y32[1]
         mov      y32[2],count[0]
         mov      y32[3],count[1]

         call   div32                  ; m/s(*100)=4444444/count

         call   conv_bcd
         mov      fsr,#bcdbuf
         mov      led_opt,#1               ; 'PˆÊ=m/s
         call   disp_num

         jnb      SW1,mode_single
         jnb      SW2,disp_j
         call   set_weight
         goto   disp_ms

         ;; ƒpƒ[(J)•\ŽÂ¦
disp_j
         clr      xd32[0]                  ; xd32=count
         clr      xd32[1]
         mov      xd32[2],count[0]
         mov      xd32[3],count[1]
         clr      y32[0]                  ; y32=count
         clr      y32[1]
         mov      y32[2],count[0]
         mov      y32[3],count[1]

         call   mul64                  ; xd32=count^2

         mov      xs32[0],xd32[0]            ; xd32‚ğ‘Ò"ğ
         mov      xs32[1],xd32[1]
         mov      xs32[2],xd32[2]
         mov      xs32[3],xd32[3]

         clr      xd32[0]                  ; xd32=987654
         mov      xd32[1],#00fh
         mov      xd32[2],#012h
         mov      xd32[3],#006h

         clr      y32[0]                  ; y32=bb_weight
         clr      y32[1]
         clr      y32[2]
         mov      y32[3],bb_weight

         call   mul64                  ; xd32=987654*bb_weight

         mov      y32[0],xs32[0]            ; y32=count^2
         mov      y32[1],xs32[1]
         mov      y32[2],xs32[2]
         mov      y32[3],xs32[3]

         call   div32                  ; J(*100)=(987654*bb_weight)/(count^2)

         call   conv_bcd
         mov      fsr,#bcdbuf
         mov      led_opt,#2               ; 'PˆÊ=J
         call   disp_num

         jnb      SW1,mode_single
         jnb      SW2,disp_ms
         call   set_weight
         goto   disp_j

err
         call   disp_err
         goto   mode_single

;;;;;;;;;;;; disp_err ;;;;;;;;;;;;;;
disp_err                                    ; ƒGƒ‰[i'0.00' ‚ğ•\ŽÂ¦A'PˆÊÃ""j
         clr      xd32[0]
         clr      xd32[1]
         clr      xd32[2]
         clr      xd32[3]
         call   conv_bcd
         mov      fsr,#bcdbuf
         clr      led_opt
         call   disp_num
         ret



;;;;;;;;;;;; set_weight ;;;;;;;;;;;;;;
set_weight                              ; BB'e‚̏d—ʐİ'è‚ğs‚¤
         clr      xd32[0]
         clr      xd32[1]
         clr      xd32[2]
         mov      xd32[3],bb_weight

         call   conv_bcd
         mov      fsr,#bcdbuf
         mov      led_opt,#3               ; 'PˆÊ=g
         call   disp_num

         jnb      SW1,write_weight
         jnb      SW2,up_cnt

down_cnt
         cje      bb_weight,#BB_MIN,set_weight
         dec      bb_weight
         goto   set_weight
up_cnt
         cje      bb_weight,#BB_MAX,set_weight
         inc      bb_weight
         goto   set_weight
write_weight                           ; EEPROM‚ɏ‘‚«žÂ‚Ş
         clr      eeadr
         mov      eedata,bb_weight
         call   eeprom_write
         ret

;;;;;;;;;;;; set_bb_count ;;;;;;;;;;;;;;
set_bb_count                           ; ˜AŽÃ‹Â‘ª'莞‚Ì'e"İ'è‚ğs‚¤
         clr      xd32[0]
         clr      xd32[1]
         clr      xd32[2]
         mov      xd32[3],bb_cnt_num

         clr      y32[0]
         clr      y32[1]
         clr      y32[2]
         mov      y32[3],#100

         call   mul64

         call   conv_bcd
         mov      fsr,#bcdbuf
         mov      led_opt,#3               ; 'PˆÊ="­
         call   disp_num

         jnb      SW1,write_count
         jnb      SW2,up_cnt0

down_cnt0
         cje      bb_cnt_num,#BB_CNT_MIN,set_bb_count
         dec      bb_cnt_num
         goto   set_bb_count
up_cnt0
         cje      bb_cnt_num,#BB_CNT_MAX,set_bb_count
         inc      bb_cnt_num
         goto   set_bb_count
write_count                              ; EEPROM‚ɏ‘‚«žÂ‚Ş
         mov      eeadr,#1
         mov      eedata,bb_cnt_num
         call   eeprom_write
         ret

;;;;;;;;;;;; conv_bcd ;;;;;;;;;;;;;;
conv_bcd                              ; xd32‚ğBCD•ÏŠ·‚µ‚Äbcdbuf(5Œ…)‚ÉŠi"[‚·‚é
         mov      fsr,#bcdbuf+4            ; 'Fxd32,xs32,y32‚¢‚¸‚ê‚à•ÏX‚³‚ê‚é
         clr      y32[0]
         clr      y32[1]
         clr      y32[2]
         mov      y32[3],#10               ; y32 = 10
conv_loop
         call   div32                  ; xd32Â€10‚Ì—]‚è‚ğbcdbuf‚Ì5Œ…–Ú‚©‚ç‹tÂ‡Â‚Ɋi"[
         mov      indirect,xs32[3]
         cje      fsr,#bcdbuf,conv_end      ; 5Œ…•ª•ÏŠ·
         dec      fsr
         goto   conv_loop
conv_end
         ret


;;;;;;;;;;;; get_key ;;;;;;;;;;;;;;
get_key
         mov      res,rb
         and      res,#00000111b
         ret

get_key2
         mov      !rb,#00000111b            ; RB0`2(SW1`3)‚ğ"ü—͂ɐ؂è‘ւ¦
         mov      cnt,#10                  ; SW"ü—̓|[ƒgˆÀ'è‚Ì‚½‚ß‚ÌWait
         call   wait100
         mov      res,rb
         and      res,#00000111b
         mov      !rb,#00000000b            ; RB0`2(LED)‚ğo—Í‚É‚·‚é
         ret


;;;;;;;;;;;; disp_num ;;;;;;;;;;;;;;
disp_num                              ; fsr‚©‚ç5Œ…•ª‚ÌBCD(3Œ…+Â¬""_ˆÈ‰º2Œ…)‚ğ—Lο3Œ…‚Å•\ŽÂ¦Â‚·‚é
         mov      !rb,#00000000b            ; RB0`2(LED)‚ğo—Í‚É‚·‚é
         and      led_opt,#00000011b
         cjne   indirect,#0,disp_3_0      ; Â¬""_ˆÊ'uŒˆ'è
         inc      fsr
         cje      indirect,#0,disp_1_2
disp_2_1
         setb   P2
         goto   disp_3_0
disp_1_2
         setb   P1
         inc      fsr
disp_3_0
         clc
         mov      keta_cnt,#1
disp_loop                              ; 3Œ…•ª•\ŽÂ¦
         mov      disp_buf,indirect
         swap   disp_buf
         or      disp_buf,led_opt
         clr      ra
         mov      rb,disp_buf
         mov      ra,keta_cnt
         mov      cnt,#50
         call   wait100
         jb      keta_cnt.2,key_chk
         inc      fsr
         rl      keta_cnt
         goto   disp_loop
key_chk                                 ; SW‰Ÿ‰º‚ŃŠƒ^[ƒ"‚·‚é
         clr      ra
         call   get_key2
         cjne   res,#07h,disp_end
         sub      fsr,#2
         goto   disp_3_0
disp_end
         mov      !rb,#00000111b            ; RB0`2(SW1`3)‚ğ"ü—͂ɐ؂è‘ւ¦
         mov      work,res
wait_key_off
         call   get_key
         cjne   res,#07h,wait_key_off
         mov      res,work               ; Œ‹‰Ê‚Íres‚É"ü‚Á‚Ä‚¢‚é
         clr      ra
         clr      rb
         ret


;;;;;;;;;;;; div32 ;;;;;;;;;;;;;;
div32                                 ; xd32 Â€ y32 ‚̏¤‚ğ xd32‚ɁA—]‚è‚ğxs32‚ÉŠi"[‚·‚é
         clr      xs32[0]
         clr      xs32[1]
         clr      xs32[2]
         clr      xs32[3]
         mov      cnt,#32
div32_loop
         clc                           ; ƒLƒƒƒŠ[‚ğƒNƒŠƒA
         rl      xd32[3]                  ; xd32<<1 bitƒVƒtƒg
         rl      xd32[2]
         rl      xd32[1]
         rl      xd32[0]
         rl      xs32[3]                  ; Œ…‚ ‚Ó‚ê‚Íxs32‚É"[‚ß‚é
         rl      xs32[2]
         rl      xs32[1]
         rl      xs32[0]

         mov      W,y32[0]               ; xs32 >= yd32‚©?
         subwf   xs32[0],0
         jnc      div32_nxt
         jnz      div32_sub
         mov      W,y32[1]
         subwf   xs32[1],0
         jnc      div32_nxt
         jnz      div32_sub
         mov      W,y32[2]
         subwf   xs32[2],0
         jnc      div32_nxt
         jnz      div32_sub
         mov      W,y32[3]
         subwf   xs32[3],0
         jnc      div32_nxt

div32_sub                              ; then xs32 = xs32 - y32
         call   sub32
         setb   xd32[3].0               ; xd32[3].0‚̃rƒbƒg‚𗧂Ăé

div32_nxt                              ; else
         djnz   cnt,div32_loop            ; 32bit•ªƒ‹[ƒv
         ret

;;;;;;;;;;;; sub32 ;;;;;;;;;;;;;;
sub32                                 ; xs32 ‚©‚ç y32 ‚ğŒ¸ŽZ‚µAŒ‹‰Ê‚ğxs32‚ÉŠi"[‚·‚é
         sub      xs32[3],y32[3]            ; xs-y [3] Ã…IŒ…‚ÌŒvŽZ
         jc      sub32_2                  ; Œ‹‰Ê‚ªÂ³Â‚Ȃç[2]Œ…ŒvŽZ‚Ö
         sub      xs32[2],#1               ; •‰‚È‚ç‘O‚ÌŒ…‚©‚ç1ˆø‚­(Žc"O‚È‚ª‚çdecf‚ÍŽg‚¦‚È‚¢)
         jc      sub32_2
         sub      xs32[1],#1
         jc      sub32_2
         dec      xs32[0]
sub32_2
         sub      xs32[2],y32[2]            ; [2]Œ…‚ÌŒvŽZ
         jc      sub32_1
         sub      xs32[1],#1
         jc      sub32_1
         dec      xs32[0]
sub32_1
         sub      xs32[1],y32[1]            ; [1]Œ…‚ÌŒvŽZ
         jc      sub32_0
         dec      xs32[0]
sub32_0
         sub      xs32[0],y32[0]            ;
  • Œ…‚ÌŒvŽZ
             ret


    ;;;;;;;;;;;; mul64 ;;;;;;;;;;;;;;
    mul64                                 ; xd32[0,1,2,3](32bit)‚Æy32[0,1,2,3](32bit)‚̐ςğxd64[0,1,2,3,4,5,6,7](64bit)‚ÉŠi"[‚·‚é
             clr      xd64[0]
             clr      xd64[1]
             clr      xd64[2]
             clr      xd64[3]
             mov      cnt,#32
    mul64_loop
             clc
             jnb      xd32[3].0,mul64_nxt
             add      xd64[3],y32[3]
             jnc      mul64_2
             inc      xd64[2]
             jnz      mul64_2
             inc      xd64[1]
             snz
             inc      xd64[0]
             
    mul64_2      add      xd64[2],y32[2]
             jnc      mul64_1
             inc      xd64[1]
             snz
             inc      xd64[0]

    mul64_1      add      xd64[1],y32[1]
             snc
             inc      xd64[0]

             add      xd64[0],y32[0]
    mul64_nxt
             rr      xd64[0]
             rr      xd64[1]
             rr      xd64[2]
             rr      xd64[3]
             rr      xd32[0]
             rr      xd32[1]
             rr      xd32[2]
             rr      xd32[3]
             djnz   cnt,mul64_loop            ; 32bit•ªƒ‹[ƒv
             ret


    ;;;;;;;;;;;; wait100;;;;;;;;;;;;
    wait100                                 ; 100ƒÊs * cnt ŽžÂŠÃ”‚ğÃ"ï
    loop_n
             mov      work,#WAIT_CNT
    loop100
             decsz   work
             goto   loop100
             decsz   cnt
             goto   loop_n
             ret

    ;;;;;;;;;;;; eeprom_read;;;;;;;;;;;;
    eeprom_read
             setb   rp0
             setb   eecon1.0
             clrb   rp0
             ret

    ;;;;;;;;;;;; eeprom_write;;;;;;;;;;;;
    eeprom_write
             setb   rp0
             setb   eecon1.2
             mov      eecon2,#55h
             mov      eecon2,#0aah
             setb   eecon1.1
    writeloop
             snb      eecon1.1
             goto   writeloop
             clrb   rp0
             ret


    ;;;;;;;;;;;;;;;;;;; ‚¨‚µ‚Ü‚¢ ;;;;;;;;;;;;;;;;;;;;;;

    HOCAM NEDEN HATA VERDİĞİ KONUSUNDA YARDIMCI OLABİLİRMİSİNİZ ACABA PROTEUS KULLANIMINDAMI HATA YAPIYORUM.
    İYİ ÇALIŞMALAR..!!!

e3

Alıntı yapılan: "taless"...SIMULATION LOG
==============
Design:   C:\PROTEUS\PROTEUS - PROGRAMLARI\DENEME.DSN
Doc. no.: <NONE>
Revision: <NONE>
Author:   <NONE>
Created:  17/02/05
Modified: 27/04/06

Compiling source files...
Build completed OK.
Compiling netlist...
Linking netlist...
Partition analysis...

Simulating partition 1 [7B4228CE]...
Animation started sucessfully...
PROSPICE Release 6.2 SP0 (C) Labcenter Electronics 1993-2002.
SPICE Kernel Version 3f5. (C) Berkeley University ERL.

Reading netlist...
Net VDD taken as alias for VCC
Net VSS taken as alias for GND
Reading SPICE models...
Building circuit...
Instantiating SPICE models...
[U1] PIC16 model release 6.01.00 simulating PIC1684 device.
[U1] Loaded 64 bytes of persistent EEPROM data.
[U1] Loading HEX file '..\..\Documents and Settings\ARİSTOTALESS\Desktop\bitti\BBSPD14.HEX'.
FATAL: [U1] Program or EEPROM data has invalid address [4000] for this device...
Taless arkadaşım ARİSTOTALES adında bir kullanıcı adına sahipsin anladığım kadarıyla.Proteus Türkçe karakter sorunu çıkarıyor.Yani Sistem deki klasör adlarınız Türkçe Karakter İçermemeli..Birinci sorun bu anladığım kadarıyla..Ancak ikinci sorun olan kodların garipliğine bi anlam veremedim..İyi günler..Kolay gelsin..;)
.eem.