News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Applying Buffered Serial In to additional Usarts

Started by JohnB, Jun 28, 2022, 05:57 AM

Previous topic - Next topic

JohnB

I am using Les's Library USART1_Buffer_K42.inc.  In order to support USART2 on the 27K42 MPU do I simply modify the library to reference USART2 or are there any other catches?
JohnB

John Lawton

Quote from: JohnB on Jun 28, 2022, 05:57 AMI am using Les's Library USART1_Buffer_K42.inc.  In order to support USART2 on the 27K42 MPU do I simply modify the library to reference USART2 or are there any other catches?

John, where can this code be found please?

top204

Yes John. Use the SFRs for USART2 instead of USART1, and rename the called library subroutines labels so they match the calls for HRsin2, HSerin2, HRsout2 and HSerout2, with and without timeouts. And do not forget to rename the include file's variables from "USART1_" to "USART2_", just to make the code more understandable when looked at in the future. :-)

I think I placed the code on the forum last year John. If not, I'll upload it. I created the code and the interrupt manager for the PIC18FxxK42 devices for my Positron8 board, but I never got to market it, because the huge time taken for all the documentation would outway the price I would get for them, and I will not release anything commercially without full, professional, documentation.

JohnB

@John Lawton  I have attached USART1 and USART2 inc files and the Interrupt Manager inc files and a Demo program. USART2_Buffer_K42.zip

Now a question for @top204
Can I mix calling USART_Get_Byte with HSerIn - it looks like I should OK but are there likely to be any  pitfalls?


JohnB