Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 02:55:26 14:55


Login with username, password and session length


Pages: [1]
Print
Author Topic: timer problem in attiny13a  (Read 3467 times)
0 Members and 1 Guest are viewing this topic.
sphinx
Hero Member
*****
Offline Offline

Posts: 899

Thank You
-Given: 604
-Receive: 260



« on: October 25, 2009, 12:16:18 00:16 »

hi all

i am trying to learn som avr assembler and i succeded to learn some stuff like setting out puts and reading inputs
and some other simple stuff, but i am not able to get the TCNT0 in ATINY13A but i have been trying to figure it out
but i cant get the timer to start no matter of what i try i have been using avr simulator to see if it works but to no
luck.

i have attached some simple asm file just to get the hang of how the timer works, maybe someone can help with my
problem

best regards
Logged

laws of physics are not laws at all, just assumptions and formulas that work as long as we don't figure something new that wrecks the calculations. the infinite onion try to peel that one
sam_des
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« Reply #1 on: October 25, 2009, 01:49:20 13:49 »

Hello sphinx,

Try attached file. I've pointed out missing code & errors...

Hope that helps,

regads
sam_des
« Last Edit: October 25, 2009, 01:52:47 13:52 by sam_des » Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
sphinx
Hero Member
*****
Offline Offline

Posts: 899

Thank You
-Given: 604
-Receive: 260



« Reply #2 on: October 25, 2009, 05:19:25 17:19 »

hi me again

i made some changes to the file and made it into a blinker at least it blinks slowly in proteus, i tried the same hex file in
AVR Simulator but there the same file wont work and thats a bit weird the tcnt0 wont change.

if someone else has simulator installed can try the file and give me a respoense back

your help was very much appreciated since my hair was getting more gray with this problem  Smiley

best regards
Logged

laws of physics are not laws at all, just assumptions and formulas that work as long as we don't figure something new that wrecks the calculations. the infinite onion try to peel that one
sam_des
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« Reply #3 on: October 25, 2009, 05:45:10 17:45 »

Hi,

Well, it's working fine here. PORTB0 is getting toggled every 10mS @ 4MHz.

Did you single-stepped through delay10ms() ? Is delay10ms() never 'returning' ? It shouldn't if TCNT0 is not running.

And why don't you use 'sbi/cbi' instructions to toggle the PB0 ?

regards,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
sphinx
Hero Member
*****
Offline Offline

Posts: 899

Thank You
-Given: 604
-Receive: 260



« Reply #4 on: October 25, 2009, 06:03:43 18:03 »

ok thats good to know

it was some time ago i programmed in assembler and i was making it for z80 and that processor works a bit in a
different way, but i am trying to learn to programm avr and i gonna try to use sbi/cbi to set and clear ports
thanx for advice, i am happy for it

regards
sphinx

tried it and it makes less code as well, so thats a good idea i will use Smiley
« Last Edit: October 25, 2009, 06:14:46 18:14 by sphinx » Logged

laws of physics are not laws at all, just assumptions and formulas that work as long as we don't figure something new that wrecks the calculations. the infinite onion try to peel that one
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC