Timer0, 1, 2, INT0, INT1, Analog Comparator
Timer0, 1, 2, INT0, INT1, Analog Comparator
Hello, i use atmega8 in many application, and i see that in libraryes is only PWM1 that work for timer2, but why isn't a PWM16 library for Timer1, to use the other two PWM channels (OC1A,OC1B)?
I see that isn't any library for the timers and interrupts, analog comparator, watchdog, or power modes. It's only a suggestion :) because other programming tools have thes things..
I want to know if in the future it is possible to make this libraryes, or i should make it my self.
I see that isn't any library for the timers and interrupts, analog comparator, watchdog, or power modes. It's only a suggestion :) because other programming tools have thes things..
I want to know if in the future it is possible to make this libraryes, or i should make it my self.
Hi,
This issue has been resolved in the upcoming release of mikroPascal PRO for AVR. It will be soon available for beta testing, so you can try giving us more suggestions in the beta-testing period, so we can improve our compilers even more.
Thank you for your support!
Best regards,
Aleksandar
This issue has been resolved in the upcoming release of mikroPascal PRO for AVR. It will be soon available for beta testing, so you can try giving us more suggestions in the beta-testing period, so we can improve our compilers even more.
Thank you for your support!
Best regards,
Aleksandar
Web Department Manager
Re:
Hi to the mikroTeam
Reason why, now I want to use the "Analog Comparator" AIN0 AIN1 & nowhere I can find them.
Chip I want to use with is ATtiny13, ATtiny26 & ATmega8 at the moment.
So I was under the impression these were to be made available in the recent release but appears to not be.
Or have I overlook where they hiding & don't know where to look?
Please do not tell me I have to write my own library or code to do this.
Awaiting for further comment.
Ken
I am wondering has any of these functions below has been implemented as requested by RCR?aleksandar.nikolic wrote:Hi,
This issue has been resolved in the upcoming release of mikroPascal PRO for AVR. It will be soon available for beta testing, so you can try giving us more suggestions in the beta-testing period, so we can improve our compilers even more.
Thank you for your support!
Best regards,
Aleksandar
Oct 19, 2009
Code: Select all
Functions In Library
Timers : None (example in assembler code)
Interrupts : Yes
Analog Comparator : None
Watchdog : None
Power Modes : ???? I presume he talking about sleep/wake up mode
Timer0, Timer1, Timer2 : None
Int0, Int1 : None
Chip I want to use with is ATtiny13, ATtiny26 & ATmega8 at the moment.
So I was under the impression these were to be made available in the recent release but appears to not be.
Or have I overlook where they hiding & don't know where to look?
Please do not tell me I have to write my own library or code to do this.
Awaiting for further comment.
Ken
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
Hello pykedgew,
1. PWM16 library is available in AVR compilers for a long time. Please take a look at mikroPascal PRO for AVR v3.20beta Help file for more information about this library. If you have any other enhancement suggestions, please explain them briefly, and I will inform our developers.
2. Timer0, Timer1, Timer2 and Interrupts: I am not quite sure what you mean by this, but you can now use timer overflow interrupts even more easier, since we have introduced iv linker directive and we have inserted all timer vectors in definition files. Here's the example of using Timer0 interrupt:
3. Analog Comparator and Power Modes: Please explain what kind of implementation do you expect, regarding these features?
4. Watchdog: We have introduced CLRDWT function that can be called from hi-level languages instead only from assembly, but generating watchdog handling routines was demonstrated in several forum posts. If you think that there should be some kind of WDT library, you may suggest so, and we I will pass this to our developers.
Best regards,
Aleksandar
1. PWM16 library is available in AVR compilers for a long time. Please take a look at mikroPascal PRO for AVR v3.20beta Help file for more information about this library. If you have any other enhancement suggestions, please explain them briefly, and I will inform our developers.
2. Timer0, Timer1, Timer2 and Interrupts: I am not quite sure what you mean by this, but you can now use timer overflow interrupts even more easier, since we have introduced iv linker directive and we have inserted all timer vectors in definition files. Here's the example of using Timer0 interrupt:
Code: Select all
procedure Timer0Overflow_ISR(); iv IVT_ADDR_TIMER0_OVF;
4. Watchdog: We have introduced CLRDWT function that can be called from hi-level languages instead only from assembly, but generating watchdog handling routines was demonstrated in several forum posts. If you think that there should be some kind of WDT library, you may suggest so, and we I will pass this to our developers.
Best regards,
Aleksandar
Web Department Manager
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
I very need
INT0, INT1, Analog Comparator
do you have any code for them?
please say me how to write them in compiler?
INT0, INT1, Analog Comparator
do you have any code for them?
please say me how to write them in compiler?
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
...but still far and away from Bascom .Timer0, Timer1, Timer2 and Interrupts: I am not quite sure what you mean by this, but you can now use timer overflow interrupts even more easier
What's the sense of pascal if you still have to push bits and bytes like in C or in ASM?
In Bascom you CAN access registers directly but you don't HAVE TO .
So it would really be great if you would integrate a more comfortable solution.
Until now I was programming my avr with bascom, but because I'm using Delphi for my Windows applications I'm testing MikropascalAVR. This limitation doesn't make the decision against bascom easier, at the moment I really don't know whether I should buy a licence or not...
Best regards
Toenne
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
I think this is an good Idea too!!
This is the reason, why I use Pascal an not gcc
This is the reason, why I use Pascal an not gcc
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
Hello,
In mikroPascal you can directly access to registers.
List of all registers can be previewed in def file.
Best regards.
Please can you explain this with a line of code.Toenne wrote:What's the sense of pascal if you still have to push bits and bytes like in C or in ASM?
In Bascom you CAN access registers directly
In mikroPascal you can directly access to registers.
List of all registers can be previewed in def file.
Best regards.
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
See attachment, it's from the bascom help file (*).
Example: I want to use timer1 in normal mode to toggle a led every second (at 16MHz).
Really simple, isn't it?
Another benefit: If I want to use the code for another type of avr (maybe because I've run out of memory so I have to use a 'bigger' one) I have to change...nothing!
All the parameters are plaintext. For example if I want to use the timer as counter I just write "Timer1 = counter". And if I want him to count on falling edges I just write "edge = falling". For all this I don't need to study the data sheet first, it's more or less self-explanatory and the same for all types. I don't have to brood about bits and bytes, I can concentrate myself for the code/solution itself.
E.g. the pwm-mode:
Nevertheless I can access the registers directly if I want so. But why should I?
It's the main advantage of high-level languages that the code is easy to write and easy to read I think. And the risk for making errors is much smaller.
I've just tried to program a countdown timer with mikropascal - and the timer did whatever he wanted to, but not what I wanted. After hours of testing it works, but know what? I have no clue why it works now but not at the beginning, looks like somewhere one bit was 'jammed'...
OK, Professionals who work every day with µc don't have this problems, they have the needed routines, registers and bits in mind. But most of them will already use C or ASM I think .
Best regards (and sorry for my scary english )
Toenne
(*) Oops - no way to attach a pdf?
Example: I want to use timer1 in normal mode to toggle a led every second (at 16MHz).
Code: Select all
$crystal = 16000000
...
Config Timer1 = Timer , Prescale = 256
On Timer1 Timer_irq
Const Timerpreset = 18661
Enable Timer1
Enable Interrupts
...
Timer_irq:
Toggle Led
Timer1 = Timerpreset
Return
Another benefit: If I want to use the code for another type of avr (maybe because I've run out of memory so I have to use a 'bigger' one) I have to change...nothing!
All the parameters are plaintext. For example if I want to use the timer as counter I just write "Timer1 = counter". And if I want him to count on falling edges I just write "edge = falling". For all this I don't need to study the data sheet first, it's more or less self-explanatory and the same for all types. I don't have to brood about bits and bytes, I can concentrate myself for the code/solution itself.
E.g. the pwm-mode:
Code: Select all
'And the TIMER can be used in PWM mode
'You have the choice between 8,9 or 10 bit PWM mode
'Also you can specify if the counter must count UP or down after a match
'to the compare registers
'Note that there are two compare registers A and B
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Down , Prescale = 1
It's the main advantage of high-level languages that the code is easy to write and easy to read I think. And the risk for making errors is much smaller.
I've just tried to program a countdown timer with mikropascal - and the timer did whatever he wanted to, but not what I wanted. After hours of testing it works, but know what? I have no clue why it works now but not at the beginning, looks like somewhere one bit was 'jammed'...
OK, Professionals who work every day with µc don't have this problems, they have the needed routines, registers and bits in mind. But most of them will already use C or ASM I think .
Best regards (and sorry for my scary english )
Toenne
(*) Oops - no way to attach a pdf?
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
I think your main question was how to access registers directly in Bascom?janko.kaljevic wrote:Please can you explain this with a line of code.Toenne wrote:In Bascom you CAN access registers directly
The names of registers (TCCR1A, ICR1H, TCNT0...) are reserved words, if you use them the complier translates them into the correct adress for the avr defined at top of program (e.g. $regfile = "m8def.dat").TCCR2A=&b10100000
Best regards,
Toenne
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
Hello,
It is good idea, and it is easier to set hardware modules this way.
And it is our goal to make programming easier with every release and to add more tools and modules which will allow faster and easier programming.
Also for us it is important suggestions like these, because we can listen what is important to our users.
Thanks for suggestion and supporting.
Also thanks for the effort that you invested in order to properly describe this matter.
Best regards.
It is good idea, and it is easier to set hardware modules this way.
And it is our goal to make programming easier with every release and to add more tools and modules which will allow faster and easier programming.
Also for us it is important suggestions like these, because we can listen what is important to our users.
Thanks for suggestion and supporting.
Also thanks for the effort that you invested in order to properly describe this matter.
Best regards.
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
You can do things like this with AVRco, another Pascal compiler for AVR--which, by the way, also has tasking built in. It's a nice development package. Very nice. But the license will cost you a fair amount more.Example: I want to use timer1 in normal mode to toggle a led every second (at 16MHz).
Code: Select all
$crystal = 16000000
...
Config Timer1 = Timer , Prescale = 256
On Timer1 Timer_irq
Const Timerpreset = 18661
Enable Timer1
Enable Interrupts
...
Timer_irq:
Toggle Led
Timer1 = Timerpreset
Return
Really simple, isn't it?
Another benefit: If I want to use the code for another type of avr (maybe because I've run out of memory so I have to use a 'bigger' one) I have to change...nothing!
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
For me, timers the basis of my application and their ommission is a major problem unless I migrate to pics.
So, please lets have counter timer functions
So, please lets have counter timer functions
Re: Timer0, 1, 2, INT0, INT1, Analog Comparator
Hi,
Thank you for your suggestion.
For now, you can use Timer examples located in the Examples folder of the compiler.
Regards,
Filip.
Thank you for your suggestion.
For now, you can use Timer examples located in the Examples folder of the compiler.
Regards,
Filip.