Nice 
If it could be matched in space, I’d still prefer to see my own code, just that I’ve never had a reason to do it until now.
It would be less in asm though, and I still think I could top it.
It was worth the effort to do with a dsPic where the pin was not mappable to UART, so incidentally tried with PBP as well.
No BASIC For/Next loop, instead I’d count down to zero.
No shift command, instead an asm rotate to ensure only 1 instruction,
My own delay routine, which is conveniently right before a return, so can be called multiple times.
watchdog timer resets also have to be turned off because PBP won’t put them in it’s own routines, but in YOUR code.
To my disadvantage, there needs to be some value stored in Delay, which would claim some more space.
Something like this (untested).. and I can’t remember if PBP labels need the underscore or not.
Code:
count var byte
pdelay var byte
serialout:
@ movlw ,8
@ movwf _count ,F
@ clrf PORTB ,1
@ call pausedelay
sendbyte:
PORTB.1 = txbyte.bit0
@ rrf txbyte ,F
@ call pausedelay
@ decfsz _count
goto sendbyte
@ bsf PORTB ,1
pausedelay:
@ movlw ,210
@ movwf _pdelay ,F
zpausedelay:
decfsz _pdelay
@ goto zpausedelay
@ return
Bookmarks