Hi,
I managed to work through the receiving and process the data and store it to DATA0.
What I can't do now is sending out serially the 8 bit DATA0 to
the pin SER_OUT(which happens to be PIN RC0).
I've tried to copy DATA0 to PORTC (in RECORD2) but since PORTC is only 6 bit, the data is not out correctly. Can anyone help me please?
;----------------------------------------
; RECORD
; Records each bit as it comes in from the data stream.
;
; Input Variables:
; RXDATA
; Output Variables: 1 bytes of the 8 bit data read from sensor
; DATA0
RECORD
movf HIGHWDTH, W
subwf LOWWDTH, W ; The state of the carry bit after
; this operation reflects the data
; logic. This is then rotated
; into the storage bytes.
rrf DATA0, F ; the only data to be processed
movlw HIGHP ; 0x04 to STATECNTR
movwf STATECNTR
decfsz BITCNTR, F ; If the bitcntr is = 0 , skip next instruction
goto MAIN
; set to count for 1 data - record 1 byte of data bit by bit
movlw D'1' ; Starting here and including RECORD1
movwf COUNTR ; a check is made to make sure that
movlw DATA0 ; the data is not composed entirely
movwf FSR ; of 1s.
;FSR is the register to store the DATA0
RECORD1 ; this is the procedure of indirect addressing
movlw 0xFF
xorwf INDF, W ; Use indirect referencing to point to
btfss STATUS, Z ; DATA0 on subsequent loops
goto RECORD2 ; in RECORD1.
incf FSR, F
decfsz COUNTR, F
goto RECORD1
goto RESTART
RECORD2
movlw WAIT
movwf STATECNTR ; Make state WAIT4END
movfw DATA0 ; copy DATA0 to PORTC
movwf PORTC ; want to send data out serially
; bsf SER_OUT ; pin RC5 to observe the processed output
goto MAIN
Bookmarks