Darkstar64
New Member
wow ive spent all day on this how hard can it be to make this work here is my code. I want it to read the 8 bit string and then one digit after the other send it out on pin GP0 and then after each digit it needs to clock on GP1 the one im using needs a low to high to clock it please help ive been at this for days I don't know if the engine works or not ether please haha I only want the first 4 LED's to light up on the shift hence the '11110000'
[/CODE]
Code:
list p=12F509 ; list directive to define processor
#include <p12F509.inc> ; processor specific variable definitions
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
cblock 0x07
;***** VARIABLE DEFINITIONS
count,temp
D
CP
delay
endc
;**********************************************************************
RESET_VECTOR CODE 0x3FF ; processor reset vector
; Internal RC calibration value is placed at location 0x3FF by Microchip
; as a movlw k, where the k is a literal value.
MAIN CODE 0x000
movwf OSCCAL ; update register with factory cal value
start
movlw b'11110000'
movlw temp
call shift
goto start
;********Subroutines********
shift
shift5 movlw 0x08 ;set loop counter
movwf count
movf INDF,w ;get a byte
movwf temp
shift1 rrf temp,f ;rotate ms-bit into carry
btfsc STATUS,C ;is it 0?
goto shift2 ;no, shift out a 1
goto shift3 ;yes, shift out a 0
shift2 bsf GPIO,1
nop
bsf GPIO,1 ;blip clock
nop
bcf GPIO,1
goto shift4
shift3 bcf GPIO,1
nop
bsf GPIO,1 ;blip clock
nop
bcf GPIO,1
shift4 decfsz count,f ;done 8-bits?
goto shift1 ;no, go again
retlw 0
END ; End of program !!
Last edited: