Riadenie HDD s PIC16f84

ÚPLNE PRVÝ ASM KTORÝ POTOM UPRAVOVALI BOL TENTO:

;hddmotor.asm - driver for 3-coil HDD motor
; 13/12/00

;PIC receives external clock from 4001 on a3 and changes
;FET-driving bit pattern
list p=16f84a
include p16f84a.inc

clock equ porta.3 ;i/p clock

ee1 dbee 24h ;100 100 bits to go out of b0 to b5, step 1
ee2 dbee 36h ;110 110 step 2
ee3 dbee 12h ;010 010 etc
ee4 dbee 1bh ;011 011
ee5 dbee 09h ;001 001
ee6 dbee 2dh ;101 101

index rb ;RAM byte for counter

entry movlw 08h ;…o iooo
tris porta
movlw 00h ;oooo oooo
tris portb
movlw 80h
option
clrf index
movlw 24h
movwf portb

clocklo btfss clock ;wait for ext clock to go high
goto clocklo

change movf index,w ;get next bit pattern from EE
movwf eeadr
call readee
movwf portb

     incf   index,f
     movlw  06         ;loop for 6 EE locations
     xorwf  index,w
     btfss  zero
     goto   clockhi
     clrf   index

clockhi btfsc clock ;wait for clock low
goto clockhi
goto clocklo ;repeat output sequence

readee bsf rp0
bsf rd
bcf rp0
movf eedata,w
return