help please
PAUSE Missing after PULSOUT 3, W1
Goto Pulse instead of Goto Bouton ---- mais à quoi servent donc les interruptions ???
et on termine en plaçant la visualisation dans le programme d'interruption juste AVANT le Enable !!! ( ça évite les affichages Ollé, Ollé ...)
Alain
Last edited by Acetronics2; - 14th August 2006 at 14:03.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
to simplify :no button
' pic16F877
'cycle = !-!_!-!_!-!_!-!_!-!__!--!_
' i use lcd just to see W0
' Define LCD registers and bits
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 8
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE OSC 4
INCLUDE "modedefs.bas" ' Include serial modes
W0 var word
W1 var word
i var byte
up var PORTB.4
dn var PORTB.5
rst var portb.6
b0 var byte
PO var portb.3 ' Define pulse output pin
'initialisation
ADCON1 = %0000111
TRISA = %1
w0=1000
i=0
B0=0
Low PO ' Initialize output polarity
'*********************
pulse:
for i =0 to 5
Pulsout 3,W0 ' Generate pulse
pause W0/100 ' Intra-pulse delay
next i
I=0
Pulsout 3,W0
W1=W0*2
Pause W1/100
Pulsout 3,W1 'double pulse ok
pause W0/100
'visualisation sur LCD
Lcdout $FE,$C0,"W0 = ",dec W0," "
Goto PULSE 'repeat cycle
I want a double pulse in end cycle but before new cycle , i want simple pediod low but it not equal w0!!!
now, the interruption does not work.
they are detected but not the button pressed and w0 pass to 0
' pic16F877
'cycle = !-!_!-!_!-!_!-!_!-!__!--!_
' i use lcd just to see W0
DEFINE OSC 4
INCLUDE "modedefs.bas" ' Include serial modes
W0 var word
W1 var word
i var byte
up var PORTB.4
dn var PORTB.5
rst var portb.6
b0 var byte
PO var portb.3 ' Define pulse output pin
OPTION_REG = $7f
'initialisation
ADCON1 = %0000111
TRISA = %1
w0=100
i=0
B0=0
Low PO ' Initialize output polarity
INTCON.0 = 0 'Clear Port Change Interrupt Flag bit
On interrupt goto bouton ' Define interrupt handler
INTCON =%10001000 'Enable RBIE
'*********************
pulse:
for i =0 to 5
Pulsout 3,W0 ' Generate pulse
pause W0/100 ' Intra-pulse delay
next i
Pulsout 3,W0
W1=W0*2
Pause W1/100
Pulsout 3,W1
pause W0/100
Goto pulse
'*********************
inc:
'Lcdout $FE,$C0,"INC"
W0 = W0 + 1
W1=W0
resume
goto pulse
'*********************
decr:
W0 = W0 - 1
W1=W0
goto pulse
'*********************
reset:
w0 = 100
W1=W0
goto pulse
'*********************
DISABLE
bouton :
INTCON.0 = 0 '
if PORTB.4=0 THEN goto inc 'not detect
if PORTB.5=0 THEN goto decr 'not detect
if PORTB.6=0 THEN goto reset 'not detect
GOTO PULSE
ENABLE
do not mix resume and goto's ...
a clear algorithm could help you.
Alain
Last edited by Acetronics2; - 14th August 2006 at 19:02.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks