Timer 0 mode timer For CSS Compiler

  // Generator frequency 100 Hz with Timer0 For Pic16f877 // //#include "D:\MICRO_PICC_Group\timer\timer_0\timer_0_100hz.h" #include <16F877.h> #device adc=8 #FUSES NOWDT,XT //No Watch Dog Timer #use delay(clock=4000000) int1 time; #int_RTCC void RTCC_isr(void) { output_toggle(pin_b0); /* time =!time; if(time==1){ output_high(pin_b0); } if(time==0){ output_low(pin_b0); }*/ set_timer0(236); } void ...

Read more

Matrix scankey 3×4 for Lcd 2 line For CSS Compiler

#include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) char const s[10]={'0','1','2','3','4','5','6','7','8','9'}; void init_mcu (void); void display (void); void display1 (void); void calculate (void); void hex_bcd2(int8 k); /*-------define keypad------------*/ #define row0 pin_b0 // input #define row1 pin_b1 // input #define row2 pin_b2 // input #define row3 pin_b3 // input #de ...

Read more

I2C bus for 24LC16 For CSS Compiler

  #include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) #use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3) #INCLUDE "LCD_4BIT.C" #include "I2C_24LCxx.c " int8 value,setpoint=112; void main(){ setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); setup_psp(PSP_DISABLED); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); set_tris_c(0B100 ...

Read more

One wire bus (DS1820) Control For CSS Compiler

#include <16F877A.h> #device adc=8 #FUSES NOWDT,XT //No Watch Dog Timer #use delay(clock=4000000) #include <Shift_595_C.c> // 25.5 C 0.5 to step #include <read_temp.c> void main(){ setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); set_tris_a(0xff); set_tris_b(0x00); value = 0; display(); delay_ms(100); while(true){ read_ds1820(); value = temp; hex_bcd(value*10); sent_data(); delay_ms(100); ...

Read more

External interrupt For CSS Compiler

#include <16F877.h> #device adc=8 #fuses XT,NOWDT,NOPROTECT,NOLVP #use delay(clock=4000000) #INT_EXT void EXT_ISR(void){ output_toggle(PIN_B7); delay_us(300); } void Init_MCU(void){ enable_interrupts(GLOBAL); enable_interrupts(INT_EXT); ext_int_edge(H_TO_L); set_tris_B(0x01); output_low(pin_B7); } void main(){ Init_MCU(); while (TRUE) { output_toggle(PIN_B6); delay_ms(1000); } }   ...

Read more

Analog to digital 8 bits For CSS Compiler

  #include <16F877.h> #device adc=8 #FUSES NOWDT ,XT #use delay(clock=4000000) #include <Lcd_4bit.c> int8 value; void main() { setup_adc_ports(AN0_AN1_AN3); setup_adc(ADC_CLOCK_DIV_2); setup_psp(PSP_DISABLED); setup_spi(SPI_SS_DISABLED); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); set_adc_channel(0); set_tris_d(0x00); set_tris_A(0xff) ...

Read more

LCD Module Display 4 line For CSS Compiler

#include <16F877.h> #device adc=8 #fuses NOWDT,HS, NOPUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG #use delay(clock=4000000) #include <Lcd_4bit.c> int16 value1,value2,value3,value4; void main(){ setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); set_tris_d(0x00); lcd_init(); lcd_row_col(1,0); lcd_putc("Electrical Power"); delay_ms(20); lcd_row_col(2,0); lcd_putc("Loei Technical "); delay_ ...

Read more
Scroll to top