View previous topic :: View next topic |
Author |
Message |
radan
Joined: 06 Jan 2007 Posts: 35
|
Posted: Tue Aug 27, 2013 8:03 am Post subject: This is a compiler bug?($ crystal) |
|
|
Code: |
$ regfile = "m128def.dat" 'declare controller
$ crystal = 18432000 '18,432 MHz crystal oscillator
'$ crystal = 16000000' 16,0 MHz crystal oscillator
'$ crystal = 14745600' 14,7456 MHz crystal oscillator
'Set RC5 (timer 1)
'************************************************* **************************************
Config Timer1 = Timer, Prescale = 1
Config Rc5 = Pind.4, Timer = 1, Wait = 2000, Mode = Background
|
Here's a piece of software.
With a frequency of 18432000 everything compiles (and works in a full program), and with 16 and 14,7456 gives an error - Error: 96 Prescale value must be 1,8,64,256 or 1024 ...
This is a compiler bug?
(BASCOM-AVR version : 2.0.7.6 ) |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Tue Aug 27, 2013 8:51 am Post subject: |
|
|
Don't use a space between the $ and the word crystal. So
Code: | $crystal = 14745600 '14,7456 MHz crystal oscillator |
and not
Code: | $ crystal = 14745600' 14,7456 MHz crystal oscillator |
And have a look in the Help, Config Rc5
It's Timer0 for default, Timer2 if available. _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
radan
Joined: 06 Jan 2007 Posts: 35
|
Posted: Tue Aug 27, 2013 9:04 am Post subject: |
|
|
Plons wrote: | Don't use a space between the $ and the word crystal. So
Code: | $crystal = 14745600 '14,7456 MHz crystal oscillator |
and not
Code: | $ crystal = 14745600' 14,7456 MHz crystal oscillator |
And have a look in the Help, Config Rc5
It's Timer0 for default, Timer2 if available. |
The code in a space between the $ and no crystal.
At a frequency of 18,432 compiled without problems!
In the Mode = Background uses a timer 16 bit. |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Tue Aug 27, 2013 9:29 am Post subject: |
|
|
Aha, I see: Mode = Background requires a 16 bit timer.
But my first remark is still valid.
I copied your posted program in the IDE and I get compiler errors.
I suggest you *copy* what you wrote in the IDE to this forum, instead of re-typing it. That prevents confusion.
Nevertheless, I see your problem when a crystal value of 16000000 or 14745600 is used.
Looks like a problem with the new Background feature. _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
radan
Joined: 06 Jan 2007 Posts: 35
|
Posted: Tue Aug 27, 2013 9:53 am Post subject: |
|
|
Plons wrote: | Aha, I see: Mode = Background requires a 16 bit timer.
But my first remark is still valid.
I copied your posted program in the IDE and I get compiler errors.
I suggest you *copy* what you wrote in the IDE to this forum, instead of re-typing it. That prevents confusion.
Nevertheless, I see your problem when a crystal value of 16000000 or 14745600 is used.
Looks like a problem with the new Background feature. |
Compile both codes, You will see the difference
Code: |
$regfile = "m128def.dat"
$crystal = 18432000
Config Timer1 = Timer , Prescale = 1
Config Rc5 = Pind.4 , Timer = 1 , Wait = 2000 , Mode = Background
|
Code: |
$regfile = "m128def.dat"
$crystal = 14745600
Config Timer1 = Timer , Prescale = 1
Config Rc5 = Pind.4 , Timer = 1 , Wait = 2000 , Mode = Background
|
|
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Tue Aug 27, 2013 10:11 am Post subject: |
|
|
Quote: | Compile both codes, You will see the difference |
I did that already
And confirmed the problem.
As an alternative, you could use Getrc5 in combination with an interrupt on the pin where the IR receiver is connected to. Getrc5 is then *in* the interrupthandler. _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|