Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

attiny861 timer1

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
robin

Bascom Member



Joined: 18 Apr 2006
Posts: 5
Location: Warrandyte - Australia

australia.gif
PostPosted: Thu Feb 23, 2012 7:29 am    Post subject: attiny861 timer1 Reply with quote

Greetings.
I am upgrading operational software from at2313 to attiny861.
The Bascom compiler does not seem to accept "Config Timer1 = Timer , Prescale = 1"
The statement line does not default to TIMER1 in red capitals for attiny861 as it does for at2313.

Both programs compile without errors and the attiny861 operates well except for the LED programmed to timer1.
I would appreciate whatever assistance is given as I am heavily committed to the attiny861 upgrade.

Compiler version :2.0.7.3
Compiler build :2.0.7.3.001
IDE version :2.0.7.3
Windows OS :Windows 7 Professional
Windows SP :Service Pack 1

Thanks and cheers.
Robin.
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Thu Feb 23, 2012 9:13 am    Post subject: Reply with quote

If one suspects a certain part of code, one usually reduces the code till only that part is left.
First step would be writing a simple program using timer1 for blinking a led.

Code:
Tim0_isr:
If Y = 251 Then
   Return

This leads to wrong content of registers, stack overflow and disabled interrupts, as the early exit by "Return" omits restoration of saved registers and exits the ISR with a RET instead of a RETI.
You can not use "Return" within an ISR, there has to be only one "Return" and it has to be at end of ISR.
Quote:
and the attiny861 operates well except for the LED programmed to timer1.

This code will not work correct on any controller type.
Back to top
View user's profile
robin

Bascom Member



Joined: 18 Apr 2006
Posts: 5
Location: Warrandyte - Australia

australia.gif
PostPosted: Thu Feb 23, 2012 10:12 am    Post subject: Reply with quote

Thank you very much MWS for pointing that out, I have corrected it .
However the compiler still seems to not recognise the "Config Timer1" directive, and only with the attiny861!!!

Which ever programs I load into my Bascom compiler that use timer1, on a variety of chips, it always displays as TIMER1 in red capitals.
"Config TIMER1 = (red) Timer (blue), Prescale = 1024"

For the attiny861 program it displays as "Config Timer1 = Timer , Prescale = 1" all in blue text and not capitalised as TIMER1.
Obviously this happens instantly the line is entered and well before compiling.

Thanks again.
Robin.
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Thu Feb 23, 2012 10:32 am    Post subject: Reply with quote

robin wrote:
However the compiler still seems to not recognise the "Config Timer1" directive, and only with the attiny861!!!
For the attiny861 program it displays as "Config Timer1 = Timer , Prescale = 1" all in blue text and not capitalised as TIMER1.

Don't be so focused on that syntax highlighting thing, timer1 works as it should.
Did you do as I suggested ?
Quote:
First step would be writing a simple program using timer1 for blinking a led.

Beside that, and without wanting to be cruel, your code is a mess. The only thing sure is where it starts, but not where it ends.
I did stop thinking about how it will run, as I saw the crisscross-jumping all around, this is no proper way to write a program.

That's why I pointed out the obvious and gave you a hint in a direction how to check the basic functionality of timer1. It seems to me you did not follow that hint, instead you got stuck on how the IDE colors the word Timer1, which btw. has nothing to do with functionality of the program.
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive 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