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 200
wend	
End
display:   
    LCDOUT $FE,$80," setting value  "
	Pause 20
	LCDOut $FE,$C0,"temp_set1=",dec4 num ," 'C" 
	Pause 20

return	

read_value:
    adcin 1,num
    pause 10
    if(num>254)then num=254
    hpwm 1,num,1000    
return




Leave a Comment

*
= 3 + 4

Read previous post:
IoT IP camera teardown and getting root password
IoT IP camera teardown and getting root password

IP Cameras have become extremely cheap in the last couple of years. Mass production made the prices of decent quality...

Close
Scroll to top