View previous topic :: View next topic |
Author |
Message |
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 2:26 pm Post subject: Wait problem |
|
|
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 |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 141
|
Posted: Tue Jan 02, 2024 2:29 pm Post subject: |
|
|
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 |
|
|
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 2:34 pm Post subject: |
|
|
I use the internal clock, no external components... |
|
Back to top |
|
|
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 2:39 pm Post subject: |
|
|
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 |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 141
|
Posted: Tue Jan 02, 2024 2:46 pm Post subject: |
|
|
You can disable CLK DIV 8 in fuses or just change $crystal to 1000000 |
|
Back to top |
|
|
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 2:53 pm Post subject: |
|
|
programmista123 wrote: | or just change $crystal to 1000000 |
64000000 |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 141
|
Posted: Tue Jan 02, 2024 3:42 pm Post subject: |
|
|
atmega64 wrote: | programmista123 wrote: | or just change $crystal to 1000000 |
64000000 |
Why 64000000? |
|
Back to top |
|
|
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 3:56 pm Post subject: |
|
|
64000000 / 8 = 8000000
Calibrated internal RC oscillator 8.0MHz |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 141
|
Posted: Tue Jan 02, 2024 4:03 pm Post subject: |
|
|
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 |
|
|
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 4:22 pm Post subject: |
|
|
there was an error in the fuse setting
All ok...
thanks |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Tue Jan 02, 2024 4:34 pm Post subject: |
|
|
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 especially if I see "Set Pllcsr.plle" _________________ Check B-Flash -my MCS bootloader app for Android |
|
Back to top |
|
|
atmega64
Joined: 23 Feb 2005 Posts: 298 Location: ITALY
|
Posted: Tue Jan 02, 2024 4:56 pm Post subject: |
|
|
Indeed...
Set Pllcsr.plle
It didn't make sense, I deleted it... |
|
Back to top |
|
|
|