View previous topic :: View next topic |
Author |
Message |
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Mon May 30, 2011 6:18 pm Post subject: Disabling HW-UART with not using $baud (solved) |
|
|
Hi,
I recently disabled the HW-UART (when pins needed for other stuff) just by not using the statement
Code: | $baud=9600 'or whatever for baudrate needed |
Now with version 2.0.5.0 I got the error message
Code: | Error : 70 Line : 996 BAUD rate not possible [-32768] , in File ... |
until I write the $baud statement in my code - which introduced the not wanted UART-setup.
Is this an new feature or a bug?
P.S.
I know how to disable the UART by hand with
Code: | UCSR0B.RXEN = 0
UCSR0B.TXEN = 0 |
I just want to know if I have to change that on my existing programs....
Last edited by laborratte on Tue May 31, 2011 4:35 pm; edited 1 time in total |
|
Back to top |
|
|
ajvuik
Joined: 28 Apr 2011 Posts: 46 Location: Netherlands
|
Posted: Mon May 30, 2011 6:48 pm Post subject: |
|
|
I recently played around with UART in a Mega8. Are you trying to do something with the soft UART? I don't know for sure of-course, because I don't know the rest of your code, but you could try:
instead of:
the second code will invoke the hardware UART if your chip has one, the first is just a statement indicating how fast you want a serial communication to work.
Atleast, that's how I understand it from the help files.
some one with more knowledge will correct me if I'm wrong.
regards |
|
Back to top |
|
|
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Mon May 30, 2011 7:10 pm Post subject: |
|
|
I don't want to use UART at all. I need the pins for other stuff.
I think most people want to use the UART so Bascom's normal behavior is to prepare the UART and using the value given in $baud fot baudrate. Till now I could disable the UART just by commenting $baud out. Then the compiler didn't include the UART setup. This seems to be changed now. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon May 30, 2011 7:59 pm Post subject: |
|
|
it was not changed. I can not reproduce it either.
best to send a zipped sample to support. _________________ Mark |
|
Back to top |
|
|
mattcro
Joined: 03 Oct 2007 Posts: 327 Location: Scotland
|
Posted: Mon May 30, 2011 8:10 pm Post subject: |
|
|
If you don't specify $baud in your code, the compiler uses whatever is set in the compiler options (Options>Compiler>Communication). If you have a silly value set here (like "1") then the compiler can't calculate the required baud divisor value and fails with that error.
Note that the compiler doesn't actually generate any UART code unless you put $BAUD in your code or use PRINT, INPUT, etc. _________________ If all else fails, read the manual. Even better: read the manual before something fails. If you can't find it in the manual, search the forum.
BascomAVR 2.0.8.5 |
|
Back to top |
|
|
Visovian
Joined: 31 Oct 2007 Posts: 584 Location: Czech
|
Posted: Tue May 31, 2011 5:07 am Post subject: |
|
|
Quote: | Note that the compiler doesn't actually generate any UART code unless you put $BAUD in your code or use PRINT, INPUT, etc.
| But it still occupies tx and rx pins. To release them use |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Tue May 31, 2011 9:31 am Post subject: |
|
|
Visovian wrote: | But it still occupies tx and rx pins. |
This statement is wrong. If the code doesn't contain anything serial-related, the UART isn't connected to the pins and they have their normal function. |
|
Back to top |
|
|
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Tue May 31, 2011 1:03 pm Post subject: |
|
|
Sorry, I forgot to say that I'm not using the IDE. The following code is working under 1.11.9.5:
Code: | 'Program "baudtest.bas"
$REGFILE = "m128def.dat"
$CRYSTAL = 8000000
$FRAMESIZE = 32
$HWSTACK = 10
$SWSTACK = 40
'$BAUD = 9600 (commented out)
do
loop |
Compiling with command
Code: | bascomp.exe baudtest.bas SS=40 FR=32 HW=10 CHIP=20
|
Under Version 2.0.5.0 and (just tested) 2.0.6.0 the error message
Code: | Error : 70 Line : 16 BAUD rate not possible [-32768] , in File : ...Baudtest.bas |
is generated.
OS is Win7 x64. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue May 31, 2011 2:56 pm Post subject: |
|
|
It was caused by a change in the report module. I changed it. _________________ Mark |
|
Back to top |
|
|
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Tue May 31, 2011 4:09 pm Post subject: |
|
|
Mark,
thank you. As always in the last 10 years: perfect support!
|
|
Back to top |
|
|
athomeelectronics
Joined: 13 Jun 2007 Posts: 60
|
Posted: Tue May 31, 2011 7:38 pm Post subject: |
|
|
albertsm wrote: | It was caused by a change in the report module. I changed it. |
Albert,
recently, there was also something wrong with baud rate error calculation on Xmega chips (report said 100% error or something). That was corrected, thanks for that.
But, there's still always error "High Baud rate error in line 0".
You can test this with code:
Code: | $regfile = "xm128a1def.dat"
$crystal = 32000000
$lib "xmega.lib"
Config Osc = Enabled , 32mhzosc = Enabled , 32khzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
Config Priority = Static , Vector = Application , Lo = Enabled
Config Com4 = 38400 , Mode = 0 , Parity = None , Stopbits = 1 , Databits = 8
Open "COM4:" For Binary As #4
Enable Interrupts
Do
NOP
Print #4 , "abc"
Loop |
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue May 31, 2011 8:31 pm Post subject: |
|
|
The name is Mark, not Albert (Alberts is my sure name)
This was a warning, I changed it. _________________ Mark |
|
Back to top |
|
|
Visovian
Joined: 31 Oct 2007 Posts: 584 Location: Czech
|
Posted: Wed Jun 01, 2011 6:38 am Post subject: |
|
|
MWS:
You are right.
I had tested it in some wrong way. |
|
Back to top |
|
|
athomeelectronics
Joined: 13 Jun 2007 Posts: 60
|
Posted: Wed Jun 01, 2011 6:56 am Post subject: |
|
|
albertsm wrote: | The name is Mark, not Albert (Alberts is my sure name)
This was a warning, I changed it. |
Thanks for changing that, Mark |
|
Back to top |
|
|
|