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(tru ...

Read more

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

Read more

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)); } } } ...

Read more

Basic input-output 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_b(0xff); delay_ms(100);} if(!input(pin_a1)){ output_b(0x00); delay_ms(100);} } } ...

Read more

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); } } ...

Read more

I2C bus for 24LC16 For Basic PRO Compiler

Include "modedefs.bas" @ Device PIC16F877,XT_OSC,WDT_off,PWRT_off,PROTECT_off ,BOD_Off define adc_bits 10 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 low portD.2 S1 var PORTA.0 sda var portc.4 scl var portc.3 addr var byte cont con %10100000 dat con 45 b0 var byte TRISA = %111111 adcon1 = 7 addr = 2 '---------------- ...

Read more

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 portA.4 'set day 0-6 s6 var portA.5 'set dat ...

Read more

External interrupt For Basic PRO Compiler

@ device pic16f877 define osc 4 define adc_bits 8 trisb =$0f L1 var portb.6 L2 var portb.7 i var byte on interrupt goto int intcon = %10010000 low L1 low L2 start: toggle L1 pause 500 goto start end disable int: toggle L2 pause 100 intcon.1 = 0 ' Clear flag resume ' Return to main program ' ...

Read more

pulse width moduration(PWM) for lcd 2 line For Basic PRO Compiler

@ device pic16f877 define osc 4 define adc_bits 8 define adc_clock 3 define adc_sampleus 50 Define LCD_DREG PORTD ' Define LCD connections Define LCD_DBIT 4 Define LCD_RSREG PORTD Define LCD_RSBIT 1 Define LCD_EREG PORTD Define LCD_EBIT 0 RW var portd.2 low RW 'LCD R/W low = write trisa = $ff trisd = $00 adcon1 = 0 num var word LCDOUT $FE,1,"lcd_read" pause 3000 while(1) gosub read_value gosub display pause ...

Read more

Analog to dugital 8 bits For Basic PRO Compiler

@ device pic16f877 define osc 4 define adc_bits 8 Define LCD_DREG PORTD ' Define LCD connections Define LCD_DBIT 4 Define LCD_RSREG PORTD Define LCD_RSBIT 1 Define LCD_EREG PORTD Define LCD_EBIT 0 RW var portd.2 low RW 'LCD R/W low = write trisa = $ff trisd = $00 adcon1 = 0 num var byte LCDOUT $FE,1,"lcd_read" pause 3000 main: gosub read_value gosub display pause 200 GoTo main End display: LCDOUT $FE,$80," ...

Read more
Scroll to top