Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

RE: [AVR-Chat] ATMEGA64L, ATMEGA64

RE: [AVR-Chat] ATMEGA64L, ATMEGA64

2011-01-31 by Tim Mitchell

----Original Message----
Show quoted textHide quoted text
From: AVR-Chat@yahoogroups.com
[mailto:AVR-Chat@yahoogroups.com] On Behalf Of Clark Martin
Sent: 30 January 2011 22:49 To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] ATMEGA64L, ATMEGA64

> On Jan 30, 2011, at 2:25 PM, Tim Mitchell wrote:
> > 
> > If this is a one-off device and you have a chip that
> > runs at 16Mhz, you'll be fine. I would not do it for
> > production though as sooner or later you will get some
> > that don't work.   
> > 
> I'd avoid doing it at all if possible.  It might work
> today, it might work tomorrow but it might not the next
> day.  Temperature is one variable that might affect it's
> working, if it gets too hot or too cold it might stop
> working.  Also it might work, or at least seem to but you
> might be getting errors that throw off the circuit's
> operation without causing it to fail altogether.      
> 

You may be right, but this was not my experience, and I hammered the devices in all sorts of conditions (not knowing about the 8Mhz limitation until I came across a couple that didn't work properly) - if they worked at all at 16Mhz then they were pretty solid. The 8MHz-only ones either would not start up, or locked up after running for a couple of seconds.



-- 
Tim Mitchell

Re: [AVR-Chat] ATMEGA64L, ATMEGA64

2011-01-31 by Clark Martin

On Jan 31, 2011, at 1:09 AM, Tim Mitchell wrote:

> ----Original Message----
> From: AVR-Chat@yahoogroups.com
> [mailto:AVR-Chat@yahoogroups.com] On Behalf Of Clark Martin
> Sent: 30 January 2011 22:49 To: AVR-Chat@yahoogroups.com
> Subject: Re: [AVR-Chat] ATMEGA64L, ATMEGA64
> 
> > I'd avoid doing it at all if possible. It might work
> > today, it might work tomorrow but it might not the next
> > day. Temperature is one variable that might affect it's
> > working, if it gets too hot or too cold it might stop
> > working. Also it might work, or at least seem to but you
> > might be getting errors that throw off the circuit's
> > operation without causing it to fail altogether. 
> > 
> 
> You may be right, but this was not my experience, and I hammered the devices in all sorts of conditions (not knowing about the 8Mhz limitation until I came across a couple that didn't work properly) - if they worked at all at 16Mhz then they were pretty solid. The 8MHz-only ones either would not start up, or locked up after running for a couple of seconds.
> 
It's always possible what you had were 16 or 20 MHz chips marked as 8MHz by Atmel.  It's a common practice, especially later in the production life when the yield on higher speed parts is up.
 
>  
> 

Clark Martin
Redwood City, CA, USA
Macintosh / Internet Consulting

"I'm a designated driver on the Information Super Highway"



[Non-text portions of this message have been removed]

Timeout detection Serial RS232 USART

2011-05-24 by farhan ahmad

Dear All,
 
I am currently in the process of writing software which involves reading characters from RS232 port. Can anyone suggest a good way of detecting a timeout condition? For example, if there will be no data on RS232 port for 500ms then program will do something else. 
 
I am using ATMEGA64 ATMEL AVR micro-controller. The software compiler is CodeVisionAVR. 
 
I hope to get valuable responses from all. 
 
Best Regards,
Farhan Ahmad

[Non-text portions of this message have been removed]

RE: [AVR-Chat] Timeout detection Serial RS232 USART

2011-05-24 by Dave McLaughlin

Not too difficult.
 
What I do is create a timer that increments every 1ms. I then create a
volatile long variable that gets incremented in the timer interrupt.
 
Now in your code you reset the timer to ZERO and then just check it for
greater than or equal to 500.
 
Main thing to make this work is not to call any function that reads the
serial port until there is anything in the buffer (assuming you use the
interrupt driven serial routines in Codevision, which I would recommend you
do?)
 
e.g. (not complete working code)
 
msTimer = 0;
 
while(1)
{
         if(rx_counter)           // Is there any RS232 data to process?
          {
                   ReadRS232();
          }
          else if
          {
                   if(msTimer >= 500)
                   {
                             DoSomethingHere();
 
                             msTimer = 0;           // Reset the timer
                   }
          }
}
 
In the above, you simply loop around looking for data arriving on the serial
port and process it if so. If not, you go off and do your other stuff after
500ms has elapsed and then go back to checking for data.
 
I have not shown the interrupt handler for the timer. Use the excellent
AVRCalc to give you a value to set one of the timers to 1ms resolution.
Simple and easy to do.
 
 
Dave...
---
Very funny Scotty, now beam down my clothes!!!
---
Show quoted textHide quoted text
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of farhan ahmad
Sent: 24 May 2011 19:55
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] Timeout detection Serial RS232 USART
 
  
Dear All,
 
I am currently in the process of writing software which involves reading
characters from RS232 port. Can anyone suggest a good way of detecting a
timeout condition? For example, if there will be no data on RS232 port for
500ms then program will do something else. 
 
I am using ATMEGA64 ATMEL AVR micro-controller. The software compiler is
CodeVisionAVR. 
 
I hope to get valuable responses from all. 
 
Best Regards,
Farhan Ahmad




[Non-text portions of this message have been removed]

Re: [AVR-Chat] Timeout detection Serial RS232 USART

2011-05-24 by Mike Bronosky

I would do the RS-232 handling via interrupts. That way your program can go
it merry way.
1) When communication data is received the normal process will be
interrupted
2) The interrupt will receive the data.
3) The data will then be ready to be placed into a variable that your code
can handle.

The first tutorial covers use of the USART.
The second tutorial explains interrupts,
The third tutorial is about interrupts and the USART

Via Dean Camera at www.avrfreaks.net

A tutorial on Using the USART with AVR-GCC
ttp://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=45341
I would think that replacing the 'while' with an 'if' there would check to
see if something has been received then doing getting that data would not
tie up the process just waiting for data.

A tutorial titled Newbie's Guide to AVR Interrupts
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=89843&highlight=interrupts

A tutorial on Interrupt driven USARTs
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=48188&highlight=interrupts

If you are not a member of www.avrfreaks.net it would help you to join up.
It free.

Also, www.smileymicros.com has valuable info and books on AVR micros. Smiley
is almost a daily contributor on AVRFreaks.

For a lot of operations with AVRs I feel interrupts are the way to go
because they free up the micro to do the mundane chores and only interrupt
that as needed.

Mike

Linux since March 2004
www.counter.li.org
Registered Linux User: #482134
Taking up Linux Ubuntu and give-up the Windos habit.
Hasta la Vista, Baby. I won't be back!
Mike Bronosky
Mike@Bronosky.com


[Non-text portions of this message have been removed]

RE: [AVR-Chat] Timeout detection Serial RS232 USART

2011-05-26 by farhan ahmad

Thanks Dave,
 
I have implemented in my code and it is working properly. 
 
Thanks for your Tip.
 
Best Regards,
Farhan Ahmad

--- On Tue, 5/24/11, Dave McLaughlin <dave_mclaughlin@nerdshack.com> wrote:
Show quoted textHide quoted text
From: Dave McLaughlin <dave_mclaughlin@nerdshack.com>
Subject: RE: [AVR-Chat] Timeout detection Serial RS232 USART
To: AVR-Chat@yahoogroups.com
Date: Tuesday, May 24, 2011, 9:02 AM


  



Not too difficult.

What I do is create a timer that increments every 1ms. I then create a
volatile long variable that gets incremented in the timer interrupt.

Now in your code you reset the timer to ZERO and then just check it for
greater than or equal to 500.

Main thing to make this work is not to call any function that reads the
serial port until there is anything in the buffer (assuming you use the
interrupt driven serial routines in Codevision, which I would recommend you
do?)

e.g. (not complete working code)

msTimer = 0;

while(1)
{
if(rx_counter) // Is there any RS232 data to process?
{
ReadRS232();
}
else if
{
if(msTimer >= 500)
{
DoSomethingHere();

msTimer = 0; // Reset the timer
}
}
}

In the above, you simply loop around looking for data arriving on the serial
port and process it if so. If not, you go off and do your other stuff after
500ms has elapsed and then go back to checking for data.

I have not shown the interrupt handler for the timer. Use the excellent
AVRCalc to give you a value to set one of the timers to 1ms resolution.
Simple and easy to do.


Dave...
---
Very funny Scotty, now beam down my clothes!!!
---

From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of farhan ahmad
Sent: 24 May 2011 19:55
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] Timeout detection Serial RS232 USART


Dear All,

I am currently in the process of writing software which involves reading
characters from RS232 port. Can anyone suggest a good way of detecting a
timeout condition? For example, if there will be no data on RS232 port for
500ms then program will do something else. 

I am using ATMEGA64 ATMEL AVR micro-controller. The software compiler is
CodeVisionAVR. 

I hope to get valuable responses from all. 

Best Regards,
Farhan Ahmad

[Non-text portions of this message have been removed]








[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.