All pastes #830375 Raw Edit

Niluje

public c v1 · immutable
#830375 ·published 2007-12-23 22:39 UTC
rendered paste body
#include <16F877A.h>#device adc=8#FUSES NOWDT, XT, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, WRT_50%#use delay(clock=4000000)/* RS       : E0   R/W      : E2   E        : E1   DB0..7   : PORT_D*/void  init_LCD(void){   delay_ms(100);      /*****************************************/   /* Function Set : 2 lines mode, 5x7 dots */   /*****************************************/   output_low(PIN_E2);   output_low(PIN_E0);   output_D(0x38);   output_low(PIN_E1);   delay_ms(1);   output_high(PIN_E1);   delay_ms(1);   output_low(PIN_E1);   /*****************************************/   /*****************************************/   /*****************************************/      delay_ms(1);      /**************************************************************/   /* Display on/off control : display on, cursor off, blinky off */   /**************************************************************/   output_low(PIN_E2);   output_low(PIN_E0);   output_D(0x0C);   output_low(PIN_E1);   delay_ms(1);   output_high(PIN_E1);   delay_ms(1);   output_low(PIN_E1);   /**************************************************************/   /**************************************************************/   /**************************************************************/      delay_ms(1);      /*****************/   /* Clear Display */   /*****************/   output_low(PIN_E2);   output_low(PIN_E0);   output_D(0x01);   output_low(PIN_E1);   delay_ms(1);   output_high(PIN_E1);   delay_ms(1);   output_low(PIN_E1);   /*****************/   /*****************/   /*****************/      delay_ms(5);      /************************************************/   /* Entry mode set : increment, entire shift off */   /************************************************/   output_low(PIN_E2);   output_low(PIN_E0);   output_D(0x06);   output_low(PIN_E1);   delay_ms(1);   output_high(PIN_E1);   delay_ms(1);   output_low(PIN_E1);   /************************************************/   /************************************************/   /************************************************/      delay_ms(1);      output_D(0x00);   }void  aff_char(char c){   output_low(PIN_E2);   output_high(PIN_E0);      output_D(c);      output_low(PIN_E1);   delay_ms(1);   output_high(PIN_E1);   delay_ms(1);   output_low(PIN_E1);      delay_ms(1);      output_D(0x00);   }void main(){   setup_adc_ports(NO_ANALOGS);   setup_adc(ADC_OFF);   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);   setup_comparator(NC_NC_NC_NC);   setup_vref(FALSE);   set_tris_D(0x00);   set_tris_E(0x00);      init_LCD();   // TODO: USER CODE!!      aff_char('a');      while(1)   {   }}