Interrupt Service Routine for Atmega 16
2007-12-05 by huiyangdoh
Yahoo Groups archive
Index last updated: 2026-04-28 22:41 UTC
Thread
2007-12-05 by huiyangdoh
I am trying to write code of interrupt service routine for Atmega 16. I got to know For UART, the ISP routine is just a line of code in enabling the UART RXD enable pin to wait for incoming data. For transmission, simply send the data and monitor the UART TXD ready pin for sending the next data. Can anybody help me to figure out the code? Many thanks.
2007-12-05 by stevech11
--- In AVR-Chat@yahoogroups.com, "huiyangdoh" <huiyangdoh@...> wrote: > > I am trying to write code of interrupt service routine for Atmega 16. > I got to know For UART, the ISP routine is just a line of code in > enabling the UART RXD enable pin to wait for incoming data. For > transmission, simply send the data and monitor the UART TXD ready pin > for sending the next data. Can anybody help me to figure out the > code? Many thanks. > On AVRfreaks.net, in the projects section, there are many, many code examples. Among them is this example of AVR UART buffered serial I/O, interrupt driven: http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=563
2007-12-05 by Roy E. Burrage
When did this list become a homework completion list? Have you tried to look at the datasheet? There are also a large number of application notes at AVR Freaks as well as the Atmel web site, have you looked there? REB huiyangdoh wrote:
>I am trying to write code of interrupt service routine for Atmega 16. >I got to know For UART, the ISP routine is just a line of code in >enabling the UART RXD enable pin to wait for incoming data. For >transmission, simply send the data and monitor the UART TXD ready pin >for sending the next data. Can anybody help me to figure out the >code? Many thanks. > > > >
2007-12-05 by Philippe Habib
When did this become the accuse everyone who doesn't understand something of not trying hard enough list? I've only been on this list a couple of weeks and I have not found this kind of attitude from a few people very helpful or welcoming. I've been writing code professionally for 20+ years but sometimes, I suspect like all of us, I don't get something or overlook something stupid and at those times it sure would be nice to know I could ask a group of professionals for some help without someone deciding my question is too stupid and that I must be a 20 year old looking for someone to do his homework for him.
> When did this list become a homework completion list? > > Have you tried to look at the datasheet? There are also a large > number > of application notes at AVR Freaks as well as the Atmel web site, have > you looked there?
2007-12-05 by David VanHorn
> I've only been on this list a couple of weeks and I have not found > this kind of attitude from a few people very helpful or welcoming. > Hmm.. What I hear you saying is that we expect too much of our members? It's one thing to say something like "Has anyone else come up against this problem", or "can anyone suggest a good way to do X", but what we've seen lately is on the order of "please send me code to do my application" (with a very vague description of the app). Doing microcontrollers is about working in a domain where there is really very little code that will just drop in. This list has been around for a LONG time, ever since I started it on E-groups back in '95 or so. It's very friendly, we have damned few arguments, but we do expect people to read the data sheets, and at least make a good stab at a problem, so that they can ask intelligent questions.
2007-12-05 by Zack Widup
Hi Philippe, The list has been deluged for quite some time with people who join and ask questions that obviously appear to be homework assignments. They show very little demonstration of knowledge of microcontrollers. Most of these e-mails come from Asian countries. When I saw your e-mail, I thought you were someone who knew something about microcontrollers and were asking a legitimate question, not someone wanting us to do their homework for them. But some people are touchy, I guess, about people doing this and just look at the foreign name and assume it's another student. Zack
On Wed, 5 Dec 2007, Philippe Habib wrote: > When did this become the accuse everyone who doesn't understand > something of not trying hard enough list? > > I've only been on this list a couple of weeks and I have not found > this kind of attitude from a few people very helpful or welcoming. > > I've been writing code professionally for 20+ years but sometimes, I > suspect like all of us, I don't get something or overlook something > stupid and at those times it sure would be nice to know I could ask a > group of professionals for some help without someone deciding my > question is too stupid and that I must be a 20 year old looking for > someone to do his homework for him. > > > >> When did this list become a homework completion list? >> >> Have you tried to look at the datasheet? There are also a large >> number >> of application notes at AVR Freaks as well as the Atmel web site, have >> you looked there? >
2007-12-05 by David VanHorn
On Dec 4, 2007 8:59 PM, huiyangdoh <huiyangdoh@yahoo.com> wrote: > I am trying to write code of interrupt service routine for Atmega 16. > I got to know For UART, the ISP routine is just a line of code in > enabling the UART RXD enable pin to wait for incoming data. For > transmission, simply send the data and monitor the UART TXD ready pin > for sending the next data. Can anybody help me to figure out the > code? Many thanks. So much depends on how the rest of your app is structured. Will you use TX and RX buffers? TX byte by byte, and RX buffer?.... One reason that you probably didn't get much response on this, is that there are a lot of ways to do this, and it's really up to you to determine what's best for the rest of your application. What >I< do, is to set up TX and RX circular buffers in SRAM, and ISRs for TX and RX. The TX ISR takes a char and puts it in the USART TX, IF there's a char to be sent, and IF the handshaking pin (if used) or Xon/Xoff state (if used) allows. The RX isr takes a char from the USART, and puts it in the buffer, checks the buffer full level, and (if used) sets hardware handshake, or (if used) sets a flag to transmit an Xoff char. A routine in the main loop checks the tx buffer for chars left by other tasks, and if there are any, enables the UDRE int which is how I send chars to the USART. The buffers are "circular" buffers, each has a "head" and "tail" pointer. In my implementations, I keep them < 255 bytes long which makes the pointer math easy, and I also keep a count of the bytes in the buffer, so I don't have to do math on the pointers to find out the state. My generic buffer routines require the caller to point to the buffer in question using the Y register, and they will get a byte, put a byte, or tell you how many bytes are in the buffer (by returning the count byte) This fits my apps well, but I almost always use a cooperative multitasking approach.
2007-12-05 by Tom Becker
> ... people who join and ask questions that obviously appear to be homework assignments.... And it happens on several lists at similar times, maybe three times each year. I'm working one on another list right now, and a few others have just passed through. I'm sure these are handy resources when you've left yourself insufficient time - and it's appropriate to get a hand slapped, I think, and some help. You won't get away with it once you're in the workplace. Bad, student, bad! Tom
2007-12-05 by David VanHorn
> A routine in the main loop checks the tx buffer for chars left by > other tasks, and if there are any, enables the UDRE int which is how I > send chars to the USART. I wasn't quite clear here, this mainline routine turns on the UDRE int if there is anything in the TX buffer when it runs. The UDRE (tx) int turns itself off if it tries to get a char to send and the "get" routine fails to get a char from the buffer (buffer empty condition) In my routines, a routine that fails for some reason returns with the carry flag set, if it succeeds, then carry is clear on return. So when the UDRE int fetches a char, it either gets a byte in the TEMP register and carry clear, and it puts the char in the USART TX and RETIs, or it gets nonsense in TEMP, and carry set, which is it's clue to turn itself off and RETI.
2007-12-06 by Tom Becker
--- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote: > I've been writing code professionally for 20+ years but sometimes, I > suspect like all of us, I don't get something or overlook something > stupid and at those times it sure would be nice to know I could ask a > group of professionals for some help without someone deciding my > question is too stupid and that I must be a 20 year old looking for > someone to do his homework for him. Some of us have been doing this for awhile, Philippe, and we see patterns. How would you suggest this real first post (just arrived on another group) should be answered? Want a job (no pay, no thanks)? "bharadwaz_srikanth wrote: I need complete ultimate information on Microcontrollers which must be self explanatory." Tom
2007-12-06 by David VanHorn
> "bharadwaz_srikanth wrote: > I need complete ultimate information on Microcontrollers which must be > self explanatory." 1: "I'm sure you do." 2: "Can you be a little less specific?" 3: "why?" :)
2007-12-06 by Michael Haisley
Maybe you could help me, then I could help you, I just need to know the speed of an unladen swallow. Thanks!
On Dec 6, 2007 7:56 AM, Tom Becker <gtbecker@rightime.com> wrote: > > --- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote: > > > I've been writing code professionally for 20+ years but sometimes, I > > suspect like all of us, I don't get something or overlook something > > stupid and at those times it sure would be nice to know I could ask a > > group of professionals for some help without someone deciding my > > question is too stupid and that I must be a 20 year old looking for > > someone to do his homework for him. > > Some of us have been doing this for awhile, Philippe, and we see > patterns. How would you suggest this real first post (just arrived on > another group) should be answered? Want a job (no pay, no thanks)? > > "bharadwaz_srikanth wrote: > I need complete ultimate information on Microcontrollers which must be > self explanatory." > > Tom > > > > > > Yahoo! Groups Links > > > >
2007-12-06 by David VanHorn
On Dec 6, 2007 1:24 PM, Michael Haisley <mhaisley@gmail.com> wrote: > Maybe you could help me, then I could help you, I just need to know > the speed of an unladen swallow. Thanks! http://www.newton.dep.anl.gov/askasci/zoo00/zoo00333.htm That's an answerable question.
2007-12-06 by Zack Widup
No no no, you're supposed to say "An African or European swallow?" :-)
On Thu, 6 Dec 2007, David VanHorn wrote: > On Dec 6, 2007 1:24 PM, Michael Haisley <mhaisley@gmail.com> wrote: >> Maybe you could help me, then I could help you, I just need to know >> the speed of an unladen swallow. Thanks! > > http://www.newton.dep.anl.gov/askasci/zoo00/zoo00333.htm > > That's an answerable question. >
2007-12-06 by David VanHorn
On Dec 6, 2007 2:10 PM, Zack Widup <w9sz@prairienet.org> wrote: > > No no no, you're supposed to say "An African or European swallow?" It was asked generally, the answer was a range.
2007-12-11 by Philippe Habib
I guess that in saying I didn't like the responses without suggesting a fix, I was doing it too. At least no one suggested I was trying to get a solution from others as part of a sociology class. I've been thinking about it and I don't think I have a solution either. I thought that maybe the group should be limited to professionals and qualified hobbyists. Does that mean an on-line quiz you have to pass to join? Does it mean you need to provide the moderator with a resume before being allowed to join? Maybe each new subscriber should just get an auto email that explains what they can/can't expect from the group and what they're expected to contribute. If you're not answering questions at least in 30% of your posts, you get put on read only status. Maybe all new users should be read only for a month or two. That would at least weed out those who join a week before the final project is due. That would approach it from the "dumb questions" side. The thing that set me off to write my message was what I saw as an unfriendly tone to the group that seemed to treat questions with a "don't bother us, just figure it out" message. The only thing I can think of for that is if you don't want to answer, just don't answer instead of accusing the person of being a cheater in a course, which you really have no way of knowing if that's the case. I can say that I've worked with my share of people who work for a living and still want it all handed to them by others. I'm sure others have too. After a few weeks of being on this list, I think I'm losing patience with the people that just ask for code too so I can understand being short with the umpteenth request to do free work for people. Sorry for the longwinded answer. I'm afraid the only concrete thing in it is to restrict the list and I don't know if there is any interest in that.
-----Original Message----- From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf Of Tom Becker Sent: Thursday, December 06, 2007 4:57 AM To: AVR-Chat@yahoogroups.com Subject: [AVR-Chat] Re: Interrupt Service Routine for Atmega 16: Homework --- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote: > I've been writing code professionally for 20+ years but sometimes, I > suspect like all of us, I don't get something or overlook something > stupid and at those times it sure would be nice to know I could ask a > group of professionals for some help without someone deciding my > question is too stupid and that I must be a 20 year old looking for > someone to do his homework for him. Some of us have been doing this for awhile, Philippe, and we see patterns. How would you suggest this real first post (just arrived on another group) should be answered? Want a job (no pay, no thanks)? "bharadwaz_srikanth wrote: I need complete ultimate information on Microcontrollers which must be self explanatory." Tom Yahoo! Groups Links -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.16.15/1174 - Release Date: 12/6/2007 10:11 AM
2007-12-11 by David VanHorn
> I've been thinking about it and I don't think I have a solution either. I > thought that maybe the group should be limited to professionals and > qualified hobbyists. You're always free to start your own group.. I started AVR-Chat when I got mad at the original AVR mailing list moderator. But too many lists dilutes things. > Does that mean an on-line quiz you have to pass to > join? Does it mean you need to provide the moderator with a resume before > being allowed to join? Maybe each new subscriber should just get an auto > email that explains what they can/can't expect from the group and what > they're expected to contribute. If you're not answering questions at least > in 30% of your posts, you get put on read only status. Maybe all new users > should be read only for a month or two. That would at least weed out those > who join a week before the final project is due. And be a LOT more work for the moderators. > After a few weeks of being on this list, I think I'm losing patience with > the people that just ask for code too so I can understand being short with > the umpteenth request to do free work for people. Speaking for myself, I don't mind newbie questions, at least something like "I'm having trouble with X, I've read the manual, etc.." The ones that are like "can someone send me code for this project", or "I need information on all microcontrollers"... Those are the annoying ones. But I understand that when you're getting started, that it can be difficult to find the right way to frame the questions. > Sorry for the longwinded answer. I'm afraid the only concrete thing in it > is to restrict the list and I don't know if there is any interest in that. We already restrict it to what we think is reasonable. Note the volume of spam you get from this list.
2007-12-11 by Tom Becker
> ... limited to professionals and qualified hobbyists. Does that mean an on-line quiz you have to pass to join? I believe most here and those on similar groups truly enjoy spontaneously helping others when they can. Those who don't, just lurk and are rarely heard and are not a problem even if they know nothing and couldn't tell others the time of day. The experience offered is free to take - but not to demand on a timeline. A short post-preventing delay for new members might have some merit - not a month, but maybe two or three days - and could serve to prevent immediate demands by those who need a comprehensive dissertation in thesis form by 15:30 next Friday. That could be circumvented by forethought, but the few offenders don't seem to exhibit such acuity. And it really doesn't happen all that often, but it is annoying when it does, and pushes over the edge some who would otherwise be politely silent - to pound out a brief flame of appreciation. Tom
2007-12-11 by Roy E. Burrage
What you're asking here, Philippe, is an awful lot of work for the moderators. I'm not one here, but do moderate others and have moderated several over the years. I don't know about the others, but I get a bit frustrated with those who want someone else to do the work for their gig...whether it's a work project, commercial product, hobby project, or school work. Apparently you've run into the same kinds of people over the years. It's easy to just not reply, but perhaps you haven't been around this list long enough to see those who, when they don't get anyone to answer their question, continue to post it. To be sure, there are means to address that issue...but it also requires a bit more work on the part of the moderators. They're volunteers. Do they deserve to get dumped on like that? I don't think so...better for the list to handle the situation. I don't recall anyone getting particularly nasty with any of the goobers who've come looking for information that's easily obtained within the first 10 pages of the datasheets, but we could have. There have been some, like the last person who came to the list looking for code, who just don't seem to be able to comprehend RTFMC before they ask for additional information. They aren't willing to do any of the work themselves, nor are they apparently willing to seek help at school...which says they probably aren't doing much of their work themselves, if I remember back a couple of years when I was there...maybe 30 some odd. I don't remember how long I've been a subscriber to this list, but I remember when it was on e-groups and then Dave VanHorn hosted it on his server for a while and then brought it back over here to the yahoos. There have been trends during that time, and we see this kind of issue come up at the end of school semesters. There have also been some come along who are just getting back into this kind of work who've asked for help. And we have. However, they've also come here with reasonable questions after having done some work themselves. Now, from a more philosophical standpoint, do we really want to have people who aren't willing to do their own work in this field of endeavor? I know a lot of us have never had the first bit of classroom training with microcontrollers or processors. I, for one, tried for many years to stay away from all this digital stuff...but was forced to do so because of customer requirements. I'll still do things with an analog circuit first if I can unload resources from the controller because it simplifies the program and allows the system to operate faster in many instances. But that's just me and my own design method. Do we really want to continue to have people coming into our field of endeavor, our profession, who spend more time trying to get others to do their work for them, thereby additionally wasting that other person's time too, than it would take to sit down and figure it out for themselves? I don't think so. Or do we want people to be able to slide through their studies, wasting their time if they just aren't capable, and ultimately going out into the workforce where they'll waste an employer's time, money and resources trying to make them into something they'll never be? I don't think so. It's better to run them off before they get too far and waste not only their time, but the time and resources of others. Just my $0.022 this afternoon... REB Philippe Habib wrote: >I guess that in saying I didn't like the responses without suggesting a fix, >I was doing it too. At least no one suggested I was trying to get a >solution from others as part of a sociology class. > >I've been thinking about it and I don't think I have a solution either. I >thought that maybe the group should be limited to professionals and >qualified hobbyists. Does that mean an on-line quiz you have to pass to >join? Does it mean you need to provide the moderator with a resume before >being allowed to join? Maybe each new subscriber should just get an auto >email that explains what they can/can't expect from the group and what >they're expected to contribute. If you're not answering questions at least >in 30% of your posts, you get put on read only status. Maybe all new users >should be read only for a month or two. That would at least weed out those >who join a week before the final project is due. > >That would approach it from the "dumb questions" side. The thing that set >me off to write my message was what I saw as an unfriendly tone to the group >that seemed to treat questions with a "don't bother us, just figure it out" >message. > >The only thing I can think of for that is if you don't want to answer, just >don't answer instead of accusing the person of being a cheater in a course, >which you really have no way of knowing if that's the case. I can say that >I've worked with my share of people who work for a living and still want it >all handed to them by others. I'm sure others have too. > >After a few weeks of being on this list, I think I'm losing patience with >the people that just ask for code too so I can understand being short with >the umpteenth request to do free work for people. > >Sorry for the longwinded answer. I'm afraid the only concrete thing in it >is to restrict the list and I don't know if there is any interest in that. > > > >-----Original Message----- >From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf >Of Tom Becker >Sent: Thursday, December 06, 2007 4:57 AM >To: AVR-Chat@yahoogroups.com >Subject: [AVR-Chat] Re: Interrupt Service Routine for Atmega 16: Homework > > >--- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote: > > > >>I've been writing code professionally for 20+ years but sometimes, I >>suspect like all of us, I don't get something or overlook something >>stupid and at those times it sure would be nice to know I could ask a >>group of professionals for some help without someone deciding my >>question is too stupid and that I must be a 20 year old looking for >>someone to do his homework for him. >> >> > >Some of us have been doing this for awhile, Philippe, and we see >patterns. How would you suggest this real first post (just arrived on >another group) should be answered? Want a job (no pay, no thanks)? > >"bharadwaz_srikanth wrote: >I need complete ultimate information on Microcontrollers which must be >self explanatory." > >Tom > > > > > >Yahoo! Groups Links > > > > > > > > [Non-text portions of this message have been removed]
2007-12-11 by Philippe Habib
I didn't mean to suggest that more screening or more evaluation of people's contribution should occur, I just wanted to say that it was the only way I could think of the address the behavior. I understand how much work it can be to start and moderate a group and I am nothing but grateful to David who took all of this work on for the benefit of others. I'm way too lazy to even think about taking on all of this work myself. Besides, with all the AVR users on this list, I'd probably have to mail donuts out to people just to get them to join my list. Maybe I was just feeling too charitable to the poor newbie who might be intimidated when I first posted. Seeing the next few days of requests for others to write code mostly cured me of that so I think I should just drop this topic. I'm still chewing on the pointers I got on my PWM problem so I should get back to work. My first real hardware arrived yesterday and it doesn't work so its not like I should be on line anyway.
-----Original Message----- From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf Of David VanHorn Sent: Tuesday, December 11, 2007 10:46 AM To: AVR-Chat@yahoogroups.com Subject: Re: [AVR-Chat] Re: Interrupt Service Routine for Atmega 16: Homework > I've been thinking about it and I don't think I have a solution either. I > thought that maybe the group should be limited to professionals and > qualified hobbyists. You're always free to start your own group.. I started AVR-Chat when I got mad at the original AVR mailing list moderator. But too many lists dilutes things. > Does that mean an on-line quiz you have to pass to > join? Does it mean you need to provide the moderator with a resume before > being allowed to join? Maybe each new subscriber should just get an auto > email that explains what they can/can't expect from the group and what > they're expected to contribute. If you're not answering questions at least > in 30% of your posts, you get put on read only status. Maybe all new users > should be read only for a month or two. That would at least weed out those > who join a week before the final project is due. And be a LOT more work for the moderators. > After a few weeks of being on this list, I think I'm losing patience with > the people that just ask for code too so I can understand being short with > the umpteenth request to do free work for people. Speaking for myself, I don't mind newbie questions, at least something like "I'm having trouble with X, I've read the manual, etc.." The ones that are like "can someone send me code for this project", or "I need information on all microcontrollers"... Those are the annoying ones. But I understand that when you're getting started, that it can be difficult to find the right way to frame the questions. > Sorry for the longwinded answer. I'm afraid the only concrete thing in it > is to restrict the list and I don't know if there is any interest in that. We already restrict it to what we think is reasonable. Note the volume of spam you get from this list. Yahoo! Groups Links -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.0/1180 - Release Date: 12/10/2007 2:51 PM
2007-12-11 by David VanHorn
> I'm still chewing on the pointers I got on my PWM problem so I should get > back to work. My first real hardware arrived yesterday and it doesn't work > so its not like I should be on line anyway. Translated to newbiespeak: "PLZ HELP ME MY NEW HARDWARE DOSENT WORK WHAT CAN I DO TO FIX IT!!!!!!!" :)
2007-12-12 by Graham Davies
--- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote: > I've only been on this list a > couple of weeks and I have not > found this kind of attitude > from a few people very helpful > or welcoming. There's nothing wrong with this list. This is the way lists are. When you join, you're supposed to figure out from other posts what is acceptable and what isn't, what the general tone is, who knows how much about what, etc., and then either stay or leave as you please. This isn't Wikipedia. If people blow off posters who won't think for themselves, it is to assert the norms of the list as well as to instruct the poster. Graham.
2007-12-12 by Zack Widup
I would kind of hope that people have some idea of using microcontrollers and some experience writing code when they join this forum. I first wrote code for the Z80 many years ago; that's where I cut my teeth so to speak. I then got interested in the 8051, 8085, MC6800, eventually the PIC's and finally AVR's. It didn't take me long to get the hang of the new code for each, since I was already familiar with the basics. All I had to do was learn the new architecture and mnemonics. I realize this isn't going to be the case with everyone, but I'd expect anyone to at least download the instruction manuals/data sheets and study them to know what their particular component of interest can and cannot do. The AVR data sheets even have example code for setting up and using the various functions like A/D converters, PWM, timers, etc. "It's in there." Zack
On Tue, 11 Dec 2007, David VanHorn wrote: > > Speaking for myself, I don't mind newbie questions, at least something > like "I'm having trouble with X, I've read the manual, etc.." > The ones that are like "can someone send me code for this project", or > "I need information on all microcontrollers"... Those are the annoying > ones. > > But I understand that when you're getting started, that it can be > difficult to find the right way to frame the questions. >