Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help needed with setting prescaller for ATmega 32

Status
Not open for further replies.

joephie

Newbie level 5
Joined
Sep 30, 2009
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
in ur heart
Activity points
1,327
[HELP] precise 1 second

can anyone help me calculating the prescale for ATmega 32 on Timer1 with crystal 11.0592 MHz. I'm using BASCOM but i don't know what is the prescale to make precise 1 second.

thank you
 

Re: [HELP] precise 1 second

Set the prescaler to 1024 and keep a 16bit counter in the interrupt routine to count to 10800(0x2a30), which will be 1 second exactly.
 

[HELP] precise 1 second

Yes do what bosparra said.
Use the compare module to count upto 10800 and then clear timer on compare (CTC) and generate interrupt on compare match.
 

Re: [HELP] precise 1 second

i'll give it a try guys.. but i have another problem on enabling the crystal. could anyone help setting up the fuse bit... wich part i should select? ? [CKSEL SUT CKOPT]
 

[HELP] precise 1 second

Set the fuse bits as:
CKOPT: 0(PROGRAMMED)
BOOTRST: 1(UNPROGRAMMED)
CKSEL3: 1(UNPROGRAMMED)
CKSEL2: 1(UNPROGRAMMED)
CKSEL1: 1(UNPROGRAMMED)
CKSEL0: 1(UNPROGRAMMED)
SUT1: 0(PROGRAMMED)
SUT0: 1(UNPROGRAMMED)
Hope this helped.
Tahmid.
 

Re: [HELP] precise 1 second

thank you very much for the help... but now im waiting the electricyti, it has been black out since yesterday ....oh my
 

Re: [HELP] precise 1 second

joephie said:
thank you very much for the help... but now im waiting the electricyti, it has been black out since yesterday ....oh my

are you from Iraq :cry:
 

this is my code

$regfile = "m32def.dat"
$crystal = 11059200

Config Timer1 = Counter , Edge = Falling , Prescale = 1024
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Porta.2 , Db5 = Porta.3 , Db6 = Porta.4 , Db7 = Porta.5 , E = Porta.1 , Rs = Porta.0
Cursor Off

Stop Counter1
Dim Speed As Long
Dim Speedo As Long

Cls
Do
Counter1 = 0
Start Counter1
Waitms 1000
Stop Counter1
Speed = Counter1
Speed = Speed * 1000
Speedo = Speed / 2
Locate 1 , 1
Lcd "pulse: " ; Speedo
Lowerline
Lcd "Rotation perminute"
Waitms 250

Loop

End

how would i know if my sistem is already running at precise 1 second.....
 

Hi,
That code seems to be written in BASCOM, am I right?
I use mikroBASIC and the codes look quite different. So I can't help you.
 

ouh, is there anyone can help....its been a headache to select the prescaler
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top