input-output

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

Basic input-output For Basic PRO Compiler

define osc 4 define adc_bits 8 trisb =$00 trisa =$ff adcon1 = 7 lamp var portb start var porta.0 stops var porta.1 lamp =0 loop: if start=0 then repeat pause 10 lamp=$ff until stops=0 ‘ if constrain true out off loop endif lamp =$00 pause 10 goto loop end