In my experience the PBP HSER Defines doesn't generate any output (ie ASM code) code unless there's also a HSEROUT statement in the code - which seem to match what you're seeing. So you can't use the DEFINE directive to configure the UART unless you're also using HSEROUT.
The fact that you CAN spoonfeed the UART and get data out means you DO have PPS and the UART itself configured properly so HSEROUT2 "should" work. Like I said, I've successfully done it on a K40 series so it must be something specific to this device or device series.
And....looking at the generated code for HSEROUT2 on a K83 here's part of it:
Code:
000004 02884 HSEROUT2 ;movlb 15 ; Set bank select to 15 to pick up any SFRs not in Access bank
000004 0139 02885 banksel PIR6 ; Set bank for PIR3
000006 0004 M clrwdt
000008 ABA6 02887 btfss PIR6, U2TXIF ; Wait till ready
00000A D7FD 02888 bra hserout2loop
00000C 013D 02913 banksel U2TXB ; Set bank for TXREG2
00000E 6FD2 02914 movwf U2TXB ; Send the char
000010 80D8 02915 bsf STATUS, C ; Set no timeout for Serout2mod
000012 EF0B F000 02916 goto DUNN ; That's it
U2TXIF has the value of 5 which is correct (U2TXIF is bit 5 in the register) but it's looking at bit 5 in PIR6 which is wrong. U2TXIF is in PIR7.
At this point I'm not sure where the actual error comes from and if it's something you or me can fix by simply editing a file or if it's buried in the exectuable of the compiler.
/Henrik.
EDIT: I think the compiler is using the pbp_pic18FxxK42.lib library file when compiling for the K83 as well because in IT is the reference to PIR6 in the HSEROUT2 function (and HSERIN2 as well) which, for the K42, is correct. For K83 it is not.
I guess we can bodge this by editing the K42.lib file but then it won't work for K42 devices so, yeah... :-(
Bookmarks