Programming Manual Elektor Proton Robot - ELEKTOR.se
Programming Manual Elektor Proton Robot - ELEKTOR.se
Programming Manual Elektor Proton Robot - ELEKTOR.se
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
The head with ldr’s, RGB-led’s and 8 led’s in the mouthSends an ever changing PWM value to the RGB led’s in the head, reads the LDR values and displays the<strong>se</strong>values on the LCDPIC16F887Demoprogram Flowcode PIC V4PROTDEM_FCPIC_HEAD.fcfDemoprogram Hitech C lite for PIC#include ATMEGA32Demoprogram Flowcode AVR V4PROTDEM_FCAVR_HEAD.fcf_avrDemoprogram WinAVR C for AVR#include #include "PIC_PROTON_LIB.h"#define _XTAL_FREQ 19660800__CONFIG(0x2ff2); // <strong>se</strong>t HS Xtal etc__CONFIG(0x3fff);void DELAYSEC (void){for (char i = 0; i < 10 ; i++) __delay_ms(100);}void main(){// init AD & Option regANSEL = 0;ANSELH = 0;OPTION = 0xC0;// end of init__delay_ms(250);__delay_ms(250); //wait for stable power supplyI2C_INIT(); // initialize I2C - LCD03 is a I2C LCDvolatile unsigned char LDR_L = 0, LDR_R =0, R= 0, G=7,B=13;while (1){LDR_L = I2C_RECEIVE_MESSAGE(0x10,8);LDR_R = I2C_RECEIVE_MESSAGE(0x10,9);I2C_SEND_MESSAGE(0x10,1,B);I2C_SEND_MESSAGE(0x10,2,G);I2C_SEND_MESSAGE(0x10,3,R);I2C_SEND_MESSAGE(0x10,4,R);I2C_SEND_MESSAGE(0x10,5,G);I2C_SEND_MESSAGE(0x10,6,B);B = B + 3;G = G + 7;R = R + 13;LCD03_CLEAR_SCREEN();LCD03_SET_CURSOR(23);LCD03_WRITE_BYTE(LDR_L);LCD03_SET_CURSOR(33);LCD03_WRITE_BYTE(LDR_R);__delay_ms(30);#define F_CPU 19660800UL#include #include "AVR_PROTON_LIB.h"#include "AVR_PROTON_LIB.c"void DELAYSEC (void){for (volatile char i = 0; i < 10 ; i++) _delay_ms(100);}int main ( void ){_delay_ms(250);_delay_ms(250); //wait for stable power supplyI2C_INIT(); // initialize I2C - LCD03 is a I2C LCDvolatile unsigned char LDR_L = 0, LDR_R =0, R= 0,G=7, B=13;while (1){LDR_L = I2C_RECEIVE_MESSAGE(0x10,8);LDR_R = I2C_RECEIVE_MESSAGE(0x10,9);}I2C_SEND_MESSAGE(0x10,1,B);I2C_SEND_MESSAGE(0x10,2,G);I2C_SEND_MESSAGE(0x10,3,R);I2C_SEND_MESSAGE(0x10,4,R);I2C_SEND_MESSAGE(0x10,5,G);I2C_SEND_MESSAGE(0x10,6,B);B = B + 3;G = G + 7;R = R + 13;LCD03_CLEAR_SCREEN();LCD03_SET_CURSOR(23);LCD03_WRITE_BYTE(LDR_L);LCD03_SET_CURSOR(33);LCD03_WRITE_BYTE(LDR_R);_delay_ms(30);}Bart Huyskens <strong>Manual</strong> <strong>Elektor</strong> <strong>Proton</strong> V1.0 3 April 2011 61