05.08.2014 Views

Programming Manual Elektor Proton Robot - ELEKTOR.se

Programming Manual Elektor Proton Robot - ELEKTOR.se

Programming Manual Elektor Proton Robot - ELEKTOR.se

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How to choo<strong>se</strong> your programming language<br />

One of the big advantages of choosing for the PROTON as your robotics and microcontroller<br />

platform is that you can choo<strong>se</strong> the microcontroller that you want. We have already<br />

prepared an AVR and a PIC add-on board.<br />

This also means that you can choo<strong>se</strong> the programming language that you prefer.<br />

We can’t support every language or every controller, but we have worked out a <strong>se</strong>t of demo<br />

programs in Flowcode and in C, and both for PIC and AVR, to demonstrate how all the<br />

components work.<br />

Flowcode is a very popular graphical programming language for PIC and AVR. It is quite a bit<br />

easier to start with in comparison with C, but is just as powerful as C. Just drag and drop the<br />

components of the flowchart of your program and FC will compile it to nice clean C code.<br />

Flowcode is developed by matrixmultimedia (www.matrixmultimedia.com) and is distributed<br />

by www.elektor.com .<br />

C is the language that all the professionals u<strong>se</strong> to program embedded systems. It’s not as<br />

easy as FC to take your first programming steps, but it gives the programmer total control.<br />

We have cho<strong>se</strong>n for free C compilers for AVR and PIC. The only big advantage of paying for a<br />

C compiler is that the<strong>se</strong> expensive compilers compile your C program a bit smaller. You<br />

would get a bit more code in your microcontroller if you pay for a compiler.<br />

Demo programs for all the components of the <strong>Proton</strong> robot, and for all 4 programming<br />

platforms can be downloaded from the elektor website.<br />

For the PIC 16F887:<br />

FLOWCODE 4 FOR PIC: the demo program: “PROTDEM_FCPIC_EMPTY” already<br />

contains <strong>se</strong>veral pre-written macro’s that make the programming of the PROTON<br />

under FC even easier. Just start with this EMPTY file to develop your own projects.<br />

We have also written a couple of demo programs in FC4 for PIC that can be<br />

downloaded from the elektor website.<br />

HITECH PICC C compiler (FREE!!): We have developed a library of instructions<br />

concerning the LCD, I2C, UART, Strings and A/D to make using the<strong>se</strong> functions a lot<br />

easier. To make u<strong>se</strong> of this library, just add: “PIC_PROTON_LIB.c” and<br />

“PIC_PROTON_LIB.h” to your project. Just have a look at the demo programs on<br />

how to u<strong>se</strong> the<strong>se</strong> libraries. This is a list of the instructions of this library.<br />

I2C/TWI FUNCTIONS<br />

void I2C_INIT();<br />

void I2C_START();<br />

void I2C_RESTART();<br />

void I2C_STOP();<br />

char I2C_TRANSMIT_BYTE(char Data);<br />

Bart Huyskens <strong>Manual</strong> <strong>Elektor</strong> <strong>Proton</strong> V1.0 3 April 2011 16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!