if it works for rs232 9600, then it's good enough for me
i'm running at meer 23 bits per sec
and i'm having trouble
but my code works fine in a simulator,
this is the code for receiving one bit
everything else should be pretty simple, it's unlikely that i made a mistake in transmission or the reception of all bits
so can you guys plz take a look at this chunk of code:
receivebit:
call delay100Us
movlw d'8'
movwf ct8 ;sets the counter to 8 in order to get 8 cycles
movlw 0h
movwf ct7;we reset reader which is ct7 (for the addef inst)
movlw 1; increment by 1
label4
btfsc portb,5 ;reads the pin
addwf ct7,1 ;if the pin is on, we add 1 to ct7, if not, zero
call delay100Us ;delay 100us
decfsz ct8,1 ;cycles 10 times to reach period of 1ms
goto label4 ;at end of cycle this is jumped
movlw d'4' ;decrement ct7 by 4
subwf ct7 ;decrements ct7 by 4
movlw d'255' ;if zero flag is off, set to positive
btfss status,0 ;tests carry flag
movlw 0h ;if carry is on, it stays on, else, it's set to null
;BIT READ IS STORED IN ct1
movwf ct1
bcf status,0
bcf status,1
call delay100Us
return ;DONE WORKING OK
NB:
result is outputted to ct1 FF->bit received and 0x00 null
portb refers to GPI0
delay100us is not actually 100us, it's the tenth of one bit's lenght
it basically takes 8 readings during one bit lenght, and if more then four readings giveout a positive reading then a high bit is received
one more thing:
i can't seem to grasp the difference between bit 0 and 1 of status and how do they work??