Menu

Attiny85 clock speed

Help
JB
2024-04-29
2024-04-30
  • JB

    JB - 2024-04-29

    Hello,

    I currently using a ATtiny85 with a simple "Blink" program to test the chip clock as ( 1Mhz,8Mhz,16Mhz )

    At 1Mhz the blink work as expected 1 sec interval between each high state.
    At clock speed 8,16Mhz the blink occur every 5~6 sec interval.

    From GCBASIC documentation page 40, : I'm a bit confused about the statement below.
    it mention if the clock is over or less than 4Mhz then in both case
    the mode will use "external oscillator mode" HS or XT
    while I'm looking to use 1,8,16Mhz internal osc.

    • An oscillator mode will be selected, based on the following rules:
    ◦ If the microcontroller has an internal oscillator, and the internal oscillator is capable of
    generating the speed specified in the #chip line, then the internal oscillator will be used.
    ◦ If the clock speed is over 4Mhz, the external HS oscillator is selected
    ◦ If the clock speed is 4 MHz or less, then the external XT oscillator mode is selected.

    Here's the code used:

    ' Attiny85 Blink Test
    '
    ;#config INTOSC_OSC_NOCLKOUT, BODEN_OFF
    #chip tiny85, 1
    ;#option Explicit
    
    ;16Mhz 6 sec
    ;8Mhz  6 sec
    ;1Mhz  1 sec
    dir portb.0 out
    dir portb.1 out
    dir portb.2 out
    dir portb.3 out
    dir portb.4 out
    
    do
    portb.0 = 1
    pause 500
    portb.0 = 0
    pause 500
    loop
    
     
  • Anobium

    Anobium - 2024-04-29

    https://gcbasic.sourceforge.io/help/_configuration.html

    The first paragraph explains.

    Note: This section does not apply to Atmel AVR microcontrollers. Atmel AVR microcontrollers
    do have a similar configuration settings, but they are controlled
    through "Configuration Fuses". GCBASIC cannot set these -
    you MUST use the programmer software.

    ATTINY85 is an AVR.

     
  • JB

    JB - 2024-04-29

    Thank's again

     
    • Anobium

      Anobium - 2024-04-29

      To be more precise. The following do work. These are a very small subset of AVRs.

      Chipfamily 121: ATTiny4-5-9-10 and ATTiny102-104 - selectable frequencies are

          ChipMHz 8
          ChipMHz 4
          ChipMHz 2
          ChipMHz 1
          ChipMHz 0.5
          ChipMHz 0.25
          ChipMHz 0.125
          ChipMHz 0.0625
          ChipMHz 0.03125
      

      Chipfamily 122: LGT chips - selectable frequencies are

          ChipMHz 32
          ChipMHz 16
          ChipMHz 8
          ChipMHz 4
          ChipMHz 2
          ChipMHz 1
          ChipMHz 0.5
          ChipMHz 0.25
          ChipMHz 0.125
          ChipMHz 0.0625
          ChipMHz 0.03125
      
       
  • JB

    JB - 2024-04-30

    Very good,
    took a screen cap.

     
    • Anobium

      Anobium - 2024-04-30

      I updated the Help page. https://gcbasic.sourceforge.io/help/_configuration.html

      If I do not document, it gets forgotten. :-)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.