Sample Code Library

Wye-delta Motor Controll For CSS Compiler

#include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) #define S1 pin_a0 #define S2 pin_a1 #define S3 pin_a2 #define K1 pin_b0 #define K2 pin_b1 #define K3 pin_b2 void main() { setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); set_tris_e(0xff); // input set_tris_b(0x00); // output output_b(0x00); // initial output = 0; while(true) { if(!input(S1)) { output_high(K1); output_high(K2); output_low(K3); delay_ms(5000); while(input(S2)) { output_high(K1); …

Wye-delta Motor Controll For CSS Compiler Read More »

Sound frequency For CSS Compiler

#include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) void sound (char freq,int16 time) // Sound Generate { unsigned char i; while (time>0) { output_low (pin_b0); for (i=1;i<=freq;i++) time–; output_high (pin_b0); for (i=1;i<=freq;i++) time–; } } void main(){ set_tris_a(0xff); set_tris_b(0x00); setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); output_b(0x00); while(true){ if(!input(pin_a0)){ sound(50,1000); sound(60,5000); sound(10,6000); sound(100,40000); } else{ sound(0,0); } } }

Forverse – Reverse Control For CSS Compiler

#include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) void main() { setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); set_tris_a(0xff); set_tris_b(0x00); output_b(0x00); while(true){ if(!input(pin_a0)){ output_high(pin_b0); output_low(pin_b1); delay_ms(100); while(!input(pin_a0));} else if(!input(pin_a1)){ output_low(pin_b0); output_high(pin_b1); delay_ms(100); while(!input(pin_a1));} else if(!input(pin_a2)){ output_low(pin_b0); output_low(pin_b1); delay_ms(100); while(!input(pin_a2));} else{ } } }

Basic Toggle Control For CSS Compiler

#include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) void main() { set_tris_a(0xff); set_tris_b(0x00); setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); output_b(0x00); while(true){ if(!input(pin_a0)){ output_toggle(pin_b0); delay_ms(100); while(!input(pin_a0)); } } }

Output Blink port For CSS Compiler

#include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) void main() { set_tris_b(0x00); setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); output_b(0x00); while(true){ output_b(0xff); delay_ms(500); output_b(0x00); delay_ms(500); } }

I2c bus for ds1307 For Basic PRO Compiler

Include “modedefs.bas” @ Device PIC16F877,XT_OSC,WDT_off,PWRT_off,PROTECT_off ,BOD_Off define adc_bits 8 define osc 4 DEFINE LCD_DREG PORTD DEFINE LCD_DBIT 4 DEFINE LCD_RSREG PORTD DEFINE LCD_RSBIT 1 DEFINE LCD_EREG PORTD DEFINE LCD_EBIT 0 S1 VAR PORTA.0 ‘set mode S2 VAR PORTA.1 ‘set hour 0-23 S3 VAR PORTA.2 ‘set minute 0-59 S4 VAR PORTA.3 ‘set second 0-59 s5 var …

I2c bus for ds1307 For Basic PRO Compiler Read More »