AlfonsoB
- 30th November 2008, 12:34
Hello everybody,
I have worked on this programme to select between two PWM values on PortB + display and by pressing a button on PORTA.0.
Unfortunately, and after pressing the button I don't get the change I want. I tried a lot but no success. I need a generous help.
Here is the code:
'PWM
include "modedefs.bas"
DEFINE LCD_DREG PORTB 'Define PIC port used for LCD Data lines
DEFINE LCD_DBIT 0 'Define first pin of portb connected to LCD DB4
DEFINE LCD_RSREG PORTB 'Define PIC port used for RS line of LCD
DEFINE LCD_RSBIT 5 'Define PIC prot used for E line of LCD
DEFINE LCD_EREG PORTB 'Define PIC prot used for E line of LCD
DEFINE LCD_EBIT 4 'Define PortB pin used for E connection
DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
DEFINE LCD_LINES 4 'Define using a 4 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent
W0 var word
ADCON1=7
TRISA=1
TRISB=0
PORTB=0
PORTA=0
'W0=0
'W0=PORTA.0
loop:
if PORTA.0 then
LCDOUT $FE,1,"PWM1",#W0," "
pwm PORTB.6,127,100
else
LCDOUT $FE,1, "PWM2",#W0," "
pwm PORTB.7,127,100
endif
goto loop
END
Many thanks in advance.
I have worked on this programme to select between two PWM values on PortB + display and by pressing a button on PORTA.0.
Unfortunately, and after pressing the button I don't get the change I want. I tried a lot but no success. I need a generous help.
Here is the code:
'PWM
include "modedefs.bas"
DEFINE LCD_DREG PORTB 'Define PIC port used for LCD Data lines
DEFINE LCD_DBIT 0 'Define first pin of portb connected to LCD DB4
DEFINE LCD_RSREG PORTB 'Define PIC port used for RS line of LCD
DEFINE LCD_RSBIT 5 'Define PIC prot used for E line of LCD
DEFINE LCD_EREG PORTB 'Define PIC prot used for E line of LCD
DEFINE LCD_EBIT 4 'Define PortB pin used for E connection
DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
DEFINE LCD_LINES 4 'Define using a 4 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent
W0 var word
ADCON1=7
TRISA=1
TRISB=0
PORTB=0
PORTA=0
'W0=0
'W0=PORTA.0
loop:
if PORTA.0 then
LCDOUT $FE,1,"PWM1",#W0," "
pwm PORTB.6,127,100
else
LCDOUT $FE,1, "PWM2",#W0," "
pwm PORTB.7,127,100
endif
goto loop
END
Many thanks in advance.