Sample Code Library

Seven segment display 4 digit for shift 595 For Basic PRO Compiler

@ device pic16f877 define osc 4 define adc_bits 8 Include “MODEDEFS.bas” DEFINE ADC_SAMPLEUS 100 DEFINE SHIFT_PAUSEUS 100 ADCON1 = 7 TRISA =$ff trisb =$00 ‘=======output=======’ dat vAR portb.0 clk vAR portb.1 latch vAR portb.2 relay VAR portb.3 ‘======input=========’ enter vAR porta.0 chg VAR porta.1 hour var byte minute var byte second var byte prsc1 var …

Seven segment display 4 digit for shift 595 For Basic PRO Compiler Read More »

Seven segment display 1 digit For Basic PRO Compiler

@ device pic16f877 define osc 4 ‘sevent segment common Anode define adc_bits 8 main: adcon1 = 7 trisa = $ff trisd = $00 disp var portd num var byte num =0 while(1) for num = 0 to 9 lookup num,[$40,$79,$24,$30,$19,$12,$02,$78,$00,$10],disp pause 500 next num wend end

Sound frequency For Basic PRO Compiler

@ device pic16f877 define osc 4 define adc_bits 8 main: trisb =$00 trisa =$ff adcon1 = 7 speaker var portb.0 sw1 var porta.0 flg_set var bit speaker =0 flg_set =0 while(1) if(!sw1) then pause 150 toggle flg_set while(!sw1):wend endif gosub sounds pause 10 wend end sounds: if(flg_set)then pause 10 sound speaker,[100,10]’100 =(1-127 generate frequency 78.74-10 …

Sound frequency For Basic PRO Compiler Read More »