Thread: Code Simulator
View Single Post
  #3   Spotlight this post!  
Unread 29-05-2005, 20:24
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Thumbs up Re: Code Simulator

Personally, I'd do it in C++, if only because I already know it. I've read a few books on C#, but I know it no where near well enough to do the fairly in depth way that will be required for this. Depends on your learning style though: if you like to get into the heavy stuff right away on a realy project, go right ahead.

I'm not positive if you're talking about a full blown simulator which would emulate all aspects of a full RC program, or just a simple training device. I'll assume the latter. (First one. I always get confused... )

There are two ways you could do it. The first way is to go from a compiled hex and execute it fairly directly (maybe?), which simplifies the final programming, but requires you to learn all the hex codes of the RC. You could also go from the source code and interpret it, which may make programming harder/longer, but will definetely require less study of something you'll use only once.

I'd personally go with the second method (from source). I've experimented with creating my own C-like interpreted language and I'd probably use something similar to that. The basic idea is the code goes through each file and builds a giant hierarchy of "variable" and "function" objects. A variable can store any value (ignore typing a way for simplicity) and a function knows how interrprut individual statements in a function.

Interrupts could also probably be fairly easily handled. Just have a seperate thread which wakes on a button press or every x ms and runs through an functions stored in a special location/vector/array.
__________________