Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Wait problem

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 2:26 pm    Post subject: Wait problem Reply with quote

Hi,

because with command:

Wait 2

it's stop only for one second?


Code:

$regfile = "Attiny45.dat"
$crystal = 8000000

Config Portb.0 = Output                                     'LED

Led Alias Portb.0

Set Pllcsr.plle      

Reset Led

Do

   Wait 2
   Toggle Led

Loop

End
 


(BASCOM-AVR version : 2.0.8.5 , Latest : 2.0.8.6 )
Back to top
View user's profile Visit poster's website
programmista123

Bascom Member



Joined: 31 Jan 2018
Posts: 141

poland.gif
PostPosted: Tue Jan 02, 2024 2:29 pm    Post subject: Reply with quote

Hi,

Are you sure you have 8 MHz clock in your design?

Regards,
Przemek

Edit: If you're using internal CLK, CKDIV8 is programmed by default. In this case, system clock is 1 MHz.
Back to top
View user's profile
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 2:34 pm    Post subject: Reply with quote

I use the internal clock, no external components...
Back to top
View user's profile Visit poster's website
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 2:39 pm    Post subject: Reply with quote

programmista123 wrote:
Hi,


Edit: If you're using internal CLK, CKDIV8 is programmed by default. In this case, system clock is 1 MHz.


so here's the problem...

so I should put

CONFIG CLOCKDIV = 1
Back to top
View user's profile Visit poster's website
programmista123

Bascom Member



Joined: 31 Jan 2018
Posts: 141

poland.gif
PostPosted: Tue Jan 02, 2024 2:46 pm    Post subject: Reply with quote

You can disable CLK DIV 8 in fuses or just change $crystal to 1000000
Back to top
View user's profile
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 2:53 pm    Post subject: Reply with quote

programmista123 wrote:
or just change $crystal to 1000000


64000000
Back to top
View user's profile Visit poster's website
programmista123

Bascom Member



Joined: 31 Jan 2018
Posts: 141

poland.gif
PostPosted: Tue Jan 02, 2024 3:42 pm    Post subject: Reply with quote

atmega64 wrote:
programmista123 wrote:
or just change $crystal to 1000000


64000000


Why 64000000?
Back to top
View user's profile
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 3:56 pm    Post subject: Reply with quote

64000000 / 8 = 8000000

Calibrated internal RC oscillator 8.0MHz
Back to top
View user's profile Visit poster's website
programmista123

Bascom Member



Joined: 31 Jan 2018
Posts: 141

poland.gif
PostPosted: Tue Jan 02, 2024 4:03 pm    Post subject: Reply with quote

Attiny comes to you with:
1. 8 MHz internal oscillator selected (CKSEl= 0010)
2. Delay = 14CK (SUT= 10)
3. CKDIV8 selected

So you have 8 MHz with divider of 8. In this case, system clock is 1MHz
Back to top
View user's profile
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 4:22 pm    Post subject: Reply with quote

there was an error in the fuse setting

All ok...
thanks
Back to top
View user's profile Visit poster's website
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Tue Jan 02, 2024 4:34 pm    Post subject: Reply with quote

Tiny85 family can be clocked from internall fast pheriperial clock where is 64MHz so it can even handle USB communication (DigiSpark for example) which needs atleast 12MHz without any externall crystal. So with dividers there is many variations of clock speed.
I also suspected wrong fuses Very Happy especially if I see "Set Pllcsr.plle"

_________________
Check B-Flash -my MCS bootloader app for Android
Back to top
View user's profile Visit poster's website
atmega64

Bascom Member



Joined: 23 Feb 2005
Posts: 298
Location: ITALY

italy.gif
PostPosted: Tue Jan 02, 2024 4:56 pm    Post subject: Reply with quote

Indeed...

Set Pllcsr.plle

It didn't make sense, I deleted it...
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR 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