atmega

Go To Last Post
43 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

intern temp atmega


 

 

Last Edited: Tue. Jan 7, 2020 - 12:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:
0.5 milliseconds

Every 500 MICROSECONDS?

 

desouza wrote:

OCR0A = 78; // 5ms

BIG difference between 5 MILLISECONDS and 500 Microseconds.

 

Add some comments to the code explaining what you are doing.  Is teh ADC set up for free running?  Can't tell as I am not carrying a datasheet with me.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:
i i want to send the internal temp ever 0.5 milliseconds

Does the temperature change that fast???

 

desouza wrote:
i dont get it to work

Not a very good problem description, can you be more specific about what is not working.

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:

SPI_transmit_data(ADC);

This function does not take arguments!  Does the compiler not complain about that???

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No sry i meant 0.5 ms

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:

SPDR = ADC;

ADC is a 16bit register, with10 bits valid but SPDR is 8bit, are you getting the 8 bits you want with this?

Perhaps SPDR = (uint8_t) ADC >> 8;  //ALAR is set so send the 8 MSB bits to SPI

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Not a very good problem description

Indeed!

 

@ desouza - standard questions:

  1. What did you expect to happen ?
  2. What is actually happening ?
  3. What testing / investigation / debugging have you done to find our where it's going wrong ?

 

desouza wrote:
i meant 0.5 ms

Which takes us back to the question of why on earth you want to measure that frequently!

 

How fast do you think the temperature can change ... ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

desouza wrote:

SPDR = ADC;

ADC is a 16bit register, with10 bits valid but SPDR is 8bit, are you getting the 8 bits you want with this?

Perhaps SPDR = (uint8_t) ADC >> 8;  //ALAR is set so send the 8 MSB bits to SPI

 

 

The OP has ADLAR set so I think they are adjusting for 8bit output from the ADC

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:
No sry i meant 0.5 ms
jgmdesign wrote:
Every 500 MICROSECONDS?

 

Tell why this might be of interest, repeatedly sending the chip temperature.  [I guess it could be an experiment with e.g. steady state, then make some outputs drive a given load, and monitor the temperature rise?]

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
The OP has ADLAR set so I think they are adjusting for 8bit output from the ADC

Would that not set SPIDR to the LSB of the ADC reg? ie.truncate the value 

With ALAR set they would only get the LSB two bits of the result in the two MSB bits!?!

Perhaps this would work better:

SPIDR = ADCH;

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

Last Edited: Thu. Jan 2, 2020 - 04:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No ADLAR truncated the two LSB off the result leaving the upper 8 bits in ADCHL

Jim

Edit....make that ADCH when ADLAR is set.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Thu. Jan 2, 2020 - 05:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ive change the code a little bit, my main issue is i cant see the internal temp when i try to print it? I haven't connected it with pins or anything i assume it works directly by activating the adc channel 8, it prints out 255 which i suppose is the memory size, but how can i get the internal temp instead?

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <avr/interrupt.h>

#include <stdio.h>

#include "ADC.h"
#include "serial.h"
#include "timer.h"

uint8_t ReadADC()
{
	//select ADC channel with safety mask
	ADMUX = (1 << MUX3);
	//single conversion mode
	ADCSRA |= (1<<ADSC);

	// wait until ADC conversion is complete
	while( ADCSRA & (1<<ADSC) );
	return ADC;
}

ISR(ADC_vect){
	
	ADCSRA |= (1 << ADSC);
}

ISR(TIMER0_COMPA_vect){
	
	printf("%d\n", ADCH);
	ReadADC(8);
}

void SPI_MASTER(){
	DDRB = (1 << PB0) | (1 << PB3) | (1 << PB5);
	SPCR = (1 << CPOL) | (1 << MSTR) | (1 << SPR0) | (1 << SPI2X) | (1 << SPE); //colckrate = 2 mhz
}

void SPI_SLAVE(){
	DDRB = (1 << PB4);
	SPCR = (1 << SPE);
}

uint8_t SPI_transmit_data(){
	PORTB &= ~(1 << PB0);
	SPDR = ADCH;
	while(!SPSR & (1<<SPIF));

	PORTB |= (1 << PB0); 
	return(SPDR);
}



void main (void) {
	timer_init();
	uart_init();
	SPI_MASTER(); //master 
	ADC_init();
	sei();
	while (1) {
		
		SPI_transmit_data();
	
	}
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


desouza wrote:
i assume it works directly by activating the adc channel 8,

You know what assume means! smiley

 

Rather then guessing, here is the datasheet section:

You need to set up the ADC ref to use the internal 1.1v ref.

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes i already did that !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:

ADMUX = (1 << MUX3);

desouza wrote:
yes i already did that !

You did?

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh sry it was in my adc.h file but i had it tho

#include <avr/io.h>
#include "ADC.h"

void ADC_init(){
	ADMUX = (1 << REFS0) | (1 << REFS1) | (1 << ADLAR);
	ADCSRA = (1 << ADEN) | (1 << ADIE) | (1 << ADPS2) | (1 << ADPS1);
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:
i cant see the internal temp when i try to print it

Doing printf within an ISR is never a good idea - certainly not when you're sampling fast!

 

surprise

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

awneil wrote:
Doing printf within an ISR is never a good idea

 

And then there is

ReadADC(8);

when ReadADC() doesn't take any arguments.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In #4, ki0bk wrote:

desouza wrote:

SPI_transmit_data(ADC);

This function does not take arguments!  Does the compiler not complain about that???

 

You'd have thought it would!

 

Similarly, in #18, El Tangas wrote:
And then there is

ReadADC(8);

when ReadADC() doesn't take any arguments.

 

@ desouza  : again, did you not get a warning about that?

 

 

If there's no warning, could that be because the declaration is:

uint8_t ReadADC()

 

rather than:

uint8_t ReadADC( void )

?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

ADMUX = (1 << MUX3);

desouza wrote:

#include <avr/io.h>
#include "ADC.h"

void ADC_init(){
	ADMUX = (1 << REFS0) | (1 << REFS1) | (1 << ADLAR);
	ADCSRA = (1 << ADEN) | (1 << ADIE) | (1 << ADPS2) | (1 << ADPS1);
}

BUT the above assignment overwrites what is in the init and sets the  ADC ref back to using VCC as ref!

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh okay i changed it, but how am i able to see the internal temperature ?  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post your current version of your code so we can see where you are at. Trusting that you did the right thing(s) is blind faith.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:
i want to send the internal temp ever 0.5 ms via the SPi bus

desouza wrote:
how am i able to see the internal temperature ?  

So what are you sending the data via SPI too?   Surely that is how you "see" it, on the device receiving the SPI data????

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Im not sending it to another mcu devie (slave), i just want to use the intern tempsensor in a SPI bus. The problem is i wan't to see if i'm putting the correct intern temperature in the SPI bus. When i try to print the adc value i get 64-128 

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <avr/interrupt.h>

#include <stdio.h>

#include "serial.h"
#include "timer.h"

uint8_t ReadADC()
{
	ADMUX = (1 << MUX3) | (1 << REFS0) | (1 << REFS1) | (1 << ADLAR);
	//single conversion mode
	ADCSRA |= (1 << ADEN) | (1<<ADSC) | (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0) | (1 << ADIE);

	// wait until ADC conversion is complete
	while( ADCSRA & (1<<ADSC) );
	return ADC;
}

ISR(ADC_vect){
	ADCSRA |= (1<<ADSC);
}

ISR(TIMER0_COMPA_vect){

	ReadADC();
}

void SPI_MASTER(){
	DDRB = (1 << PB0) | (1 << PB3) | (1 << PB5);
	SPCR = (1 << CPOL) | (1 << MSTR) | (1 << SPR0) | (1 << SPI2X) | (1 << SPE); //colckrate = 2 mhz
}

uint8_t SPI_transmit_data(){
	PORTB &= ~(1 << PB0);
	SPDR = ADC;
	while(!SPSR & (1<<SPIF));

	PORTB |= (1 << PB0);
	return(SPDR);
}

void main (void) {
	timer_init();
	uart_init();
	SPI_MASTER(); //master aktiv
	ADC_init();
	SPI_transmit_data();
	sei();
	while (1) {

	printf("%d\n", ReadADC());

	}
}

 

Last Edited: Sat. Jan 4, 2020 - 12:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <avr/interrupt.h>

#include <stdio.h>

#include "serial.h"
#include "timer.h"

uint16_t ReadADC(uint8_t chan)
{
	ADMUX = (chan & 0x0f) | (1 << REFS0) | (1 << REFS1);
	//single conversion mode
	ADCSRA |= (1 << ADEN) | (1<<ADSC) | (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

	// wait until ADC conversion is complete
	while( ADCSRA & (1<<ADSC) );
	return ADCW;
}


void SPI_MASTER(){
	DDRB = (1 << PB0) | (1 << PB3) | (1 << PB5);
	SPCR = (1 << CPOL) | (1 << MSTR) | (1 << SPR0) | (1 << SPI2X) | (1 << SPE); //clockrate = 2 MHz
}

uint8_t SPI_transmit_data( uint8_t val)
{
	PORTB &= ~(1 << PB0);
	SPDR = val;
	while(!SPSR & (1<<SPIF));

	PORTB |= (1 << PB0);
	return SPDR;
}

void main (void) 
{
 uint16_t adcVal;
       

	uart_init();
        ADC_init();
	SPI_MASTER(); //master aktiv
	
	


	while (1) 
           {
           adcVal = ReadADC(8);
	   printf("%d\n", adcVal);
           SPI_transmit_data(adcVal >> 8);   
	   }
}

Start simple - get it working. I removed adc interrupts as they did nothing. I also removed the timer. 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay thx!! i understand chan, but why do you right shift adcVal with 8? do u put it to channel 8? Oh i used the timers to send the adc value every 0.5ms

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why shift adcVal right 8 bits? Error! Should shift right 2 bits. Otherwise, does it work??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay i think so i get value 344!

Last Edited: Sun. Jan 5, 2020 - 04:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Why shift adcVal right 8 bits? Error! Should shift right 2 bits. Otherwise, does it work??

Why not use ADLAR and then theres no shift?  Does one Really need the last two bits?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
Does one Really need the last two bits?

According to the data sheet the resolution is LSB = 1 degree C so if the OP wants temperature shown in steps of 4 deg, then no, but I would want to see 1 deg C steps, so I would want all 10 bits.

But that is me...

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

if i want to send the value through spi every 1s can i put the transmission inside the isr interuppt or should it be in the while(1) instead? Two diffrent examples ->

 

ISR(TIMER1_COMPA_vect){

  adcVal = ReadADC(8);
  SPI_transmit_data(adcVal);
          
}

void main (void)
{

timer();
    uart_init();
        //ADC_init();
    SPI_MASTER(); //master aktiv
  sei();

    while (1)
           {

          
       }
}

// OR LIKE THIS???

void timer() {
        TCCR1A = (1 << WGM12) | (1 << WGM13); //ctc mode
        TIMSK1 = (1 << OCIE1A);
            TCCR1B = (1 << CS12) | (1 << CS10); //1024
        OCR1A = 15625; // 1s
}

ISR(TIMER1_COMPA_vect){

  adcVal = ReadADC(8);
}

void main (void)
{

timer();
    uart_init();
        //ADC_init();
    SPI_MASTER(); //master aktiv
  sei();

    while (1)
           {

           SPI_transmit_data(adcVal);
       }
}
Last Edited: Mon. Jan 6, 2020 - 03:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should "never" put things which require a "long" time inside an ISR.

 

In general, that would include any form of serial comms.

 

However, you could start the transmission in the ISR - and then wait outside the ISR for it to complete.

This is very common!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay so i shouldnt use readADC in the interrupt? So i can use the transmission inside the isr like this?

 

ISR(TIMER1_COMPA_vect){

  SPI_transmit_data(adcVal);
          
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just answered that in #32!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok i understand but ReadADC only chooses the right adc channel and returns it during the interuppt which seems to work 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There’s many ways to solve the problem - some are better than others. I’d suggest you set a flag in the timerisr, then have code in the while loop test for that flag then do the adc then the spi.

I wrote a tutorial on multitasking. It’s in the tutorials section. I also wrote a tutorial on the traps when using interrupts. A quick Google. should find them.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

okay


 
Last Edited: Tue. Jan 7, 2020 - 12:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

desouza wrote:

    while (1)
           {
        adcVal = ReadADC(8);
      if(flag == 1){
           SPI_transmit_data(adcVal);
           printf("%d\n", adcVal);
            }
       }

Your indentation is all over the place!

 

Once the flag is set there, you never clear it ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Shared variables MUST be volatile!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

didn't someone write a tutorial about that ... ?

 

cheeky

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I predict 60.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

What's going on with this thread?

 

  • The title seems to have been pruned twice, and is now just "atmega"
  • Almost the entire content of the OP has disappeared.

 

surprise

 

 

EDIT

 

And the code from #37 has disappeared:

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Jan 7, 2020 - 12:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I noticed that as well.  No idea why the OP deleted things.

 

JIm

 

EDIT:

I have PM'ed the OP to see if they made the changes and why.

 

Stay Tuned

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Tue. Jan 7, 2020 - 03:32 AM