View previous topic :: View next topic |
Author |
Message |
snipsnip
Joined: 10 Feb 2014 Posts: 74 Location: Melbourne
|
Posted: Tue Dec 23, 2014 11:52 pm Post subject: sharing hardware and software uart |
|
|
Hi all,
was wondering if its ok to join the hardware TX pin with the defined software TX pin, and same with the RX.
I need to change the baud rate of a GPS chip at startup - from 9600 to >56000
so if I could start up with a software port at 9600, print the command to switch the GPS to 56k baud
then revert to the main program loop which runs the hardware uart at 56k??
Cheers
Simon
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Wed Dec 24, 2014 3:03 pm Post subject: $BAUD and BAUD |
|
|
I read this in the help:
Quote: | $BAUD overrides the compiler setting for the baud rate and BAUD will change the current baud rate.
So $BAUD is a global project setting in your source code while BAUD will change the baud rate during run time.
You could use BAUD to change the baud rate during run time after the user changes a setting.
|
My two cents. Have fun
Ben Zijlstra |
|
Back to top |
|
|
snipsnip
Joined: 10 Feb 2014 Posts: 74 Location: Melbourne
|
Posted: Wed Dec 24, 2014 8:45 pm Post subject: |
|
|
doh
just read the help.
I've always thought the hardware uart baud was fixed at compile and couldn't be changed, don't know why
thanks Ben |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Dec 25, 2014 9:53 pm Post subject: |
|
|
depending on when you started using bascom, it was fixed indeed. But the baud statement was added at some stage.
of course you can also share SW and HW uart on the same pins but you need to turn on/off the HW UART pins when using the SW uart. Not really practicle.
using a SW uart you can also change the baud at run time. _________________ Mark |
|
Back to top |
|
|
snipsnip
Joined: 10 Feb 2014 Posts: 74 Location: Melbourne
|
Posted: Fri Dec 26, 2014 12:22 am Post subject: |
|
|
cool, i'm not going nuts.
It would've been around ten years ago when I first used Bascom for Serial. |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Fri Dec 26, 2014 12:29 am Post subject: |
|
|
Some time ago I wrote a sub to change the baud rate of the hardware port by writing to the registers.
I also had not noticed the baud directive now I can get rid of it and replace it with just one line
Bascom just keeps getting better & better
Regards Paul |
|
Back to top |
|
|
|