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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PIC16F887Demoprogram Flowcode PIC V4PROTDEM_FCPIC_BUZ.fcfDemoprogram Hitech C lite for PIC#include #include "PIC_PROTON_LIB.h"#define _XTAL_FREQ 19660800__CONFIG(0x2ff2); // <strong>se</strong>t HS Xtal etc__CONFIG(0x3fff);void main(){// init AD & Option regANSEL = 0;ANSELH = 0;OPTION = 0xC0;// end of init__delay_ms(250);__delay_ms(250); //wait for stable power supplyTRISA &= ~0x10; //PIN A4 = outputvolatile unsigned int x;while (1){while (x < 250){PORTA |= 0x10; //pin A4 High__delay_ms(1);PORTA &= ~0x10; //pin A4 Low__delay_ms(1);x++;}x = 0;}while (x < 500){PORTA |= 0x10; //pin A4 High__delay_us(500);PORTA &= ~0x10; //pin A4 Low__delay_us(500);x++;}x = 0;}A police sirenATMEGA32Demoprogram Flowcode AVR V4PROTDEM_FCAVR_BUZ.fcf_avrDemoprogram WinAVR C for AVR#include #define F_CPU 19660800UL#include #include "AVR_PROTON_LIB.h"int main ( void ){_delay_ms(250);_delay_ms(250); //wait for stable power supplyDDRD |= 0x80; //PIN D7 = outputvolatile unsigned int x;while (1){while (x < 250){PORTD |= 0x80; //pin D7 High_delay_ms(1);PORTD &= ~0x80; //pin D7 Low_delay_ms(1);x++;}}x = 0;while (x < 500){PORTD |= 0x80; //pin D7 High_delay_us(500);PORTD &= ~0x80; //pin D7 Low_delay_us(500);x++;}x = 0;}Bart Huyskens <strong>Manual</strong> <strong>Elektor</strong> <strong>Proton</strong> V1.0 3 April 2011 39

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

Saved successfully!

Ooh no, something went wrong!