I don't think i can do better than the following... 197 words now !!
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 & %01111100 ' Get only PORTB<6:2> bits SELECT CASE MaskFromPORTB CASE %00100000 amountofpulsout=10 case %00110000 amountofpulsout=1 case %00100100 amountofpulsout=2 case %00110100 amountofpulsout=3 case %01100000 amountofpulsout=4 case %01110000 amountofpulsout=5 case %01100100 amountofpulsout=6 case %01110100 amountofpulsout=7 case %00101000 amountofpulsout=8 case %00111000 amountofpulsout=9 case else amountofpulsout=0 end select if amountofpulsout>0 then for loopvar=0 to amountofpulsout PulsOut PORTA.2, 50000 Pause 500 next end endif GoTo SWITCH
the only thing i'm not sure of was on your following linesSince PORTA.2 is the output for your pulsout... i'd assume you was meaning PORTB.2Code:IF (PORTA.2 = 0) AND (PORTB.3 = 1) AND (PORTB.6 = 0) AND (PORTB.4 = 0) AND (PORTB.5 = 1) Then GoTo SW8 IF (PORTA.2 = 0) AND (PORTB.3 = 1) AND (PORTB.6 = 0) AND (PORTB.4 = 1) AND (PORTB.5 = 1) Then GoTo SW9
let us know what happen on this.




Bookmarks