Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

This is a compiler bug?($ crystal)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
radan

Bascom Member



Joined: 06 Jan 2007
Posts: 35

ukraine.gif
PostPosted: Tue Aug 27, 2013 8:03 am    Post subject: This is a compiler bug?($ crystal) Reply with quote

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
View user's profile Visit poster's website
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Tue Aug 27, 2013 8:51 am    Post subject: Reply with quote

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.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
radan

Bascom Member



Joined: 06 Jan 2007
Posts: 35

ukraine.gif
PostPosted: Tue Aug 27, 2013 9:04 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Tue Aug 27, 2013 9:29 am    Post subject: Reply with quote

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.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
radan

Bascom Member



Joined: 06 Jan 2007
Posts: 35

ukraine.gif
PostPosted: Tue Aug 27, 2013 9:53 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Tue Aug 27, 2013 10:11 am    Post subject: Reply with quote

Quote:
Compile both codes, You will see the difference

I did that already Smile
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.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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