Quote Originally Posted by mpgmike View Post
I’m working with an ELM327 OBD to USART Interpreter (communicates with 1996+ automotive ECUs). It initializes at 38400 Baud. It has faster options, which I want to capitalize upon. Once a faster option is programmed, it will always communicate at that faster Baud rate from that point onward. I tried DEFINE-ing HSER1_BAUD at 115200 in the upper portion of my code, and then reDEFINE-ing it at the 38400 rate in the subroutine that initializes the ELM327. The Compiler gave me an error for DEFINE-ing the same thing more than once.

I see only one option; use SPRG1H/SPRG1/Sync/BRGH/BRG to define baud rate in both instances. I worked out the math, but I haven’t breadboarded it yet. Will the HSERIN/OUT Commands work without the appropriate HSER1_BAUD DEFINE since I can’t declare it twice? Ideally I’d like to structure the Header DEFINE for the 115200 and change it in the “used only once” subroutine to the 38400. Experienced thoughts appreciated.
Go with SPRG1H/SPRG1/Sync/BRGH/BRG, works fine for changing baudrate anytime in your code.

Also, get Mr E's Multicalc: http://www.picbasic.co.uk/forum/show...286#post130286 it's a real helper!