AVRjs

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

Hi All,

 

Just wanted to introduce a project of mine which I have just added to the projects section: avrjs.com

 

It is an in-browser AVR simulator which can simulate either the ATtiny1634 and the ATmega128. It was made mainly as a learning exercise for me, I'm aware its pretty useless, but I hope it is at least interesting.

 

I will do my best to answer any questions below.

 

Cheers

avrjs.com

Last Edited: Thu. Aug 18, 2016 - 05:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRfreaks.

 

I loaded up a HEX file from a simple application i wrote for the 1634 that uses both the usarts and three IO pins and nothing happens.

 

Can you explain a little better as to what your program does?

 

JIm

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

Please Read: Code-of-Conduct

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

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

Hi JIm,

 

There is only one UART hooked up to any actual IO on the simulator (UART0). The rest of the IO should do nothing, essentially writing to UDR1 (or most of the other SFRs) should just be like writing to any other memory location. So if your UART0 port either uses flow control or only does things as a result of a GPIO or UART1 event, then your program is unlikely to do anything.

 

Under the hood, there are two callbacks for each of the SFRs; one that fires on read and on on write (if the callback function pointers are non 0).  The callbacks for the registers to do with UART0 all have valid callbacks, the ones to do with UART1 and all the GPIO ports do not. It should not he too difficult to add them and tailor these to your application if you have the motivation.

 

It may well be that you have uncovered a bug/missing feature, after all this thing is a bit of fun and not meticulously tested. If you are willing to share your code I could tell you more.

avrjs.com

Last Edited: Fri. Aug 26, 2016 - 03:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I certainly can share the code.  It really does not do much other than take the information coming in on USART0 and compares it to two possible commands.  If the string matches one of the two commands, it outputs a different command on USART1.  USART0 is running at 38400baud, and USART1 is running at 9600baud.

 

When a valid match is made an I/O pin lights an LED for a second to indicate that it recognised something.

 

BAsed on what your text in the program states, and your commentary here, I am still having a tough time understanding what I could accomplish using your program, but I am also interested in your answer as well.

 

JIm

Attachment(s): 

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

Please Read: Code-of-Conduct

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

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

Thanks for the code, It doesn't appear to do anything because the only output that does anything is UART0, you are using UART1.

 

jgmdesign wrote:

BAsed on what your text in the program states, and your commentary here, I am still having a tough time understanding what I could accomplish using your program, but I am also interested in your answer as well.

 

As I said in my post above, It is pretty useless, at least if you are expecting it to run code that "does useful stuff". However, if you are looking to learn about the internals of AVRs and are fed up with trawling through all the docs, then taking a look at what this code does when different instructions are fed in might be a different approach.

 

Having said that, if you were designing a complex system that needed to be modeled in software, the underlying simulator could be a useful tool alongside a model of the rest of the system. However I don't think there are many, if any, systems warranting this level of design effort that would include an AVR.

avrjs.com

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

Can you provide code that I can run to show what you are explaining?

Jim

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

Please Read: Code-of-Conduct

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

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

Sure, here is your code, broken in terms of its intended purpose, but wrangled to do "something" when loaded onto avrjs.com.

 

I had to change the patterns as you can't input non printable characters to the terminal, they are now just simply "on" and "off".

Attachment(s): 

avrjs.com

Last Edited: Sat. Aug 27, 2016 - 01:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had a brief look at your code on github. Looks like a fine piece of work. May i suggest you target the mega328 as the arduino bunnies will probably find your online sim useful.

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

I looked at what you modified, and essentially you rewrote the entire code to be able to work with your simulator.

 

I'll run it in the morning and see what it does.  But can you possibly explain to me what would push me to use your simulator for code as opposed to the simulator in Studio?

 

Jim

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

Please Read: Code-of-Conduct

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

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

Kartman wrote:
I had a brief look at your code on github. Looks like a fine piece of work. May i suggest you target the mega328 as the arduino bunnies will probably find your online sim useful.

Gee thanks! I will put that on the top of my list. (It took me a while to get round to it, but the 328 is now supported)!

 

jgmdesign wrote:

I looked at what you modified, and essentially you rewrote the entire code to be able to work with your simulator.

That is how I interpreted this:

jgmdesign wrote:
Can you provide code that I can run to show what you are explaining? Jim

Please be more specific with what you require.

 

jgmdesign wrote:
But can you possibly explain to me what would push me to use your simulator for code as opposed to the simulator in Studio?

It was never made to compete with Atmel, it was made to teach me about the AVR platform. It's only real advantage is the extensibility that comes with being open source.

 

Maybe if I'm being generous to myself I might say it is easier to run really noddy programs on AVRjs. e.g. If you are just getting into MCU programming and want a place to test your simple "Hello World!" program, setting up the Atmel simulator might involve a bit more effort.

avrjs.com

Last Edited: Mon. Nov 21, 2016 - 06:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok.  I guess I am just being dense.  Not the first time smiley

 

JIm

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

Please Read: Code-of-Conduct

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