For some good docs written by a friend of mine, check out the avr material on this page: http://eecs.oregonstate.edu/education/classes/ece375/index.html It should get you up and running quickly. -Shawn Randy Ott wrote: > Roy, > > Take a look at a program I wrote as a learning exercise that does something > simular to what you are trying to do. It is a simulation of the old "magic > 8 ball" that reads message strings from flash and displays them on an LCD. > The best example is one that outputs to the UART and is named 8BALLSIO.ASM > and is located at www.qsl.net/k5hj/avr along with a bunch of other small > programs I did in order to learn about the AVR. Most are written for the > 2313 but should apply to the MEGA parts as well. > > Randy Ott > > On Sat, 12 Jun 2004 09:07:25 +1200, Hopkins wrote > >>Thanks again David - >> >>just one point I do not understand and that is how do you know the >>Table_Offset value or how do you know just were the table is located >>in memory? >> >>************************************************* >>Roy Hopkins :-) >> >>Tauranga >>New Zealand >>************************************************* >> >>>>How do you program a lookup table in an AVR (ATMega 8) using assembler >> >>code? >> >>>Assuming two regs named TEMP, TEMP2, and a ram var called Table_Offset >> >>with the pointer to the position in the table: >> >>>Get_Table_Byte: >>> ldi TEMP,0 ;For the 16 bit add to follow >>> lds TEMP2,Table_Offset ;Get the offset >>> ldi ZL,low(Table*2) ;Point at the table >>> ldi ZH,high(Table*2) ; >>> add ZL,TEMP2 ;Add the offset as a 16 bit op >>> adc ZH,TEMP ;so the table can be anywhere. >>> lpm ;Defaults to R0, some AVRs can put it in other registers. >>> >>> ret ;Byte (Table offset) of TABLE is now in R0 >>> >>>For reading multiple bytes, continue with >>> >>>adiw ZL,1 >>>lpm >>> >>>and so on. >>> >>>Data is stored in WORDS in the AVR rom, but recalled in BYTES. >>>Also, the assembler will append an extra null to the end of a .db that is >> >>an odd number of bytes long. >> >>>TABLE: .db 0x45,0x46,0x47 >>> >>>Ends up in rom as 45,46,47,00 << Extra null added by assembler. >>> >>>A table that ends in a null, like: >>> >>>TABLE: .db 0x45,0x46,0x43,0x47,0x00 >>> >>>ends up looking like this: 45,46,43,47,00,00 >>> >> >>--- >>Outgoing mail is certified Virus Free. >>Checked by AVG anti-virus system (http://www.grisoft.com). >>Version: 6.0.703 / Virus Database: 459 - Release Date: 10/06/2004 >> >>-- >>http://www.piclist.com hint: The list server can filter out subtopics >>(like ads or off topics) for you. See http://www.piclist.com/#topics >> >>-- >>This message has been scanned for viruses and >>dangerous content by MailScanner, and is >>believed to be clean. > > > > -- > WebMail Provided by sbnweb.com (http://www.sbnweb.com) > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics