Arduino Emulation on PC
April 15, 2012 6 Comments
I have worked on this for a while and was able to run arduino code on my PC. This is to make debugging much easier and compiling much faster (1 second compared with minutes of compile and upload). Since the purpose was to develop phi_prompt programs, I only made emulations on key Arduino functions, liquidcrystal, DS1307, phi_interface, and phi_prompt libraries. There are no real hardware hooked up to arduino. Future development may include some limited feature such as digitalWrite or other hardware that I might need for projects. Here are some pictures to accompany my previous post about the professional development kit for phi_prompt:
The supported Arduino stuff is here:
millis();
microSeconds(); //Good luck with this on a multitasking operating system!
delay();
PROGMEM related definitions and functions. Seems to be working with “c-strings in PROGMEM and a pointer array in PROGMEM to point to these strings”. I have not tested other data types. Be careful with this though, pitfalls may still exist
strcpy_P();
strlen_P();
strlcpy(); // This is only available with GNU C not a standard one but I need it.
pgm_read_byte();
pgm_read_word();
LiquidCrystal library. Will work on write(char), print(int) and print(float)
Everything except for below functions, which I don’t use
void noDisplay(); ///< Turns off the display
void display(); ///< Turn on the display
void scrollDisplayLeft(); // Hate these scroll functions. Useless
void scrollDisplayRight();
void leftToRight();
void rightToLeft();
void autoscroll();
void noAutoscroll();
void createChar(uint8_t, unit8_t*); // I can’t create char on PC
DS1307 all working except for this one I didn’t implement. Easy to do though. Also start and stop have no actions. You can’t change DOW without changing dates.
int get(int, boolean);
phi_interfaces input device library only has the phi_serial_keypads class which takes inputs from keyboard. Function keys are wsadfg of course (who didn’t play some FPS games?)
phi_prompt user interface library works except that the right arrow looks different and the scroll bar is not as awesome as on real LCD