12.07.2015 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.

With the red and black button – you can now control the position of the <strong>se</strong>rvo-motors of the grippermodule.PIC16F887Demoprogram Flowcode PIC V4PROTDEM_FCPIC_GRIP.fcfDemoprogram Hitech C lite for PIC#include ATMEGA32Demoprogram Flowcode AVR V4PROTDEM_FCAVR_SERVO.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 supplyunsigned char SER_L = 150, SER_R = 150;#define F_CPU 19660800UL#include #include "AVR_PROTON_LIB.h"#include "AVR_PROTON_LIB.c"int main ( void ){unsigned char SER_L = 150, SER_R = 150;_delay_ms(250);_delay_ms(250); //wait for stable power supplyI2C_INIT(); // initialize I2CI2C_SEND_MESSAGE(0xAA,0,2); // <strong>se</strong>rvo's gripperonwhile (1){if (PIND & 0b00000100){SER_L++;SER_R--;}I2C_INIT(); // initialize I2CI2C_SEND_MESSAGE(0xAA,0,2); // <strong>se</strong>rvo's gripperonwhile (1){if (PORTB & 0b00010000){SER_L++;SER_R--;}el<strong>se</strong> if (PORTB & 0b00100000){SER_L--;SER_R++;}I2C_SEND_MESSAGE(0xAA,3,SER_R);I2C_SEND_MESSAGE(0xAA,4,SER_L);}}el<strong>se</strong> if (PIND & 0b00001000){SER_L--;SER_R++;}I2C_SEND_MESSAGE(0xAA,3,SER_R);I2C_SEND_MESSAGE(0xAA,4,SER_L);}}Bart Huyskens <strong>Manual</strong> <strong>Elektor</strong> <strong>Proton</strong> V1.0 3 April 2011 56

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

Saved successfully!

Ooh no, something went wrong!