Breaking News

Main Menu

Attiny13 Software Uart Bascom

среда 05 декабря admin 98
Attiny13 Software Uart Bascom 4,5/5 1084 votes

I did not find much information about how can you calculate the time using timer1 on Atiny 85. All tutorials are dealing with timer0, Timer 1 is a particular one is not compatible with others, It has precallers from 1/2-1/16384 Synchronous Clocking Mode. The problem is that about any prescaler I chose lets say on internal clock 8Mhz with normal formula. (1/clock)*prescaler=Timer tick.I get totally different timing than one expected.I load the time on OCR1A and toggle some pins the time is much less. I cleared before TCCR1=0 so does not have other prescaler set. Can you give me a hint on what is going on?I did not find any info on how to calculate timing on timer 1.It seems different than normal timer0 I can manually trial and error tweak for the value I need but this is not professional.

Hi, I was wondering, if there is any possible way to use RS-232 in the attiny13. I was trying to use software uart (program was compiled in BASCOM-Basic), but It was always out of SRAM. Tiny13 has ony 64 bytes of SRAM. ATtiny13 Software UART library. Contribute to lpodkalicki/attiny13-software-uart-library development by creating an account on GitHub.

If you want accurate timing, say for sampling a serial UART input, then you are much better off using the hardware to reset the counter as there will be no lag. If you reset the counter inside your interrupt service routine then you are going to have to account for the drift introduced by running the code. The ISR preamble takes about 42 CPU cycles to execute; there is overhead to execute the interrupt, disable global interrupts and to save registers.

So in your example the counter reset is apx 43 CPU cycles after the compare match. So after the initial two toggles, the pin is being toggled every 93 (50 + 43) CPU clock cycles.

Code lag on executing a timed action can be fine, e.g. Toggling the pin 45 CPU cycles after a compare match that triggers an interrupt every 100 cycles would still give you a pin that toggled every 100 cycles. However introducing code lag into the reset of your counter changes the actual timing.

Thank you so much for the nice work! Electrax 2 vst free download. I tried to compile the program using the command (I changed the value of the MCU to “MCU=attiny13a” in the uart.h file as well): $sudo avr-gcc -Wall -g -Os -mmcu=attiny13a -DF_CPU=1200000 -I.