you can still save codespace using the following... but this imply to modify your circuit too. It will gives you pulses from 0-15 depending on the PORTB<3:0> binary representation
Code:
DEFINE OSC 4
TRISB = %11111111
TRISA=%11111011
MaskFromPORTB var byte
AmountOfPulsout var byte
LoopVar var byte
PORTA.2=1
Pause 50
SWITCH:
Pause 250
IF PORTA.4 = 1 Then End
MaskFromPORTB=PORTB & %00001111 ' Get only PORTB<3:0> bits
amountofpulsout = maskfromPORTB
if amountofpulsout>0 then
for loopvar=0 to amountofpulsout
PulsOut PORTA.2, 50000
Pause 500
next
end
endif
GoTo SWITCH
about 118 words nows... can use PIC12c508 or else 12c or 12F for that. without any need of external crystal or oscillator.
if you remove PULSOUT statement and you use those line
Code:
PORTA.2=0
PAUSE 500
PORTA.2=1
the whole code will take about 87 words...
Last edited by mister_e; - 16th January 2005 at 21:02.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks