Thanks for the zip!
OK, getting there. Here is the code at the moment.
The problem is with the inputs. It will not fire the outputs unless PORTA.4 = 1 AND PORTA.5 = 0Code:OSCCON = $70 'set internal resonator to 8mhz Define ADC_BITS 10 ' Set number of bits in result Define ADC_CLOCK 5 ' Set clock source (3=rc) Define ADC_SAMPLEUS 20 ' Set sampling time in uS DEFINE OSC 8 BNK1 VAR WORD BNK2 VAR WORD DUR VAR WORD ADCON0 = %00000001 ADCON1 = %01111100 ADCON2 = %10111110 TRISA = %11111111 TRISB = %11110000 PORTB.0 = 1 PORTB.1 = 1 PORTB.2 = 1 PORTB.3 = 0 BNK1 = 0 BNK2 = 0 DUR = 0 MAIN: DUR = 0 PORTB.3 = 0 BNK1 = 0 BNK2 = 0 ADCIN 0, BNK1 ADCIN 1, BNK2 IF PORTB.4 = 1 then DUR = 8 endif IF PORTB.5 = 1 THEN DUR = 4 endif IF PORTB.6 = 1 THEN DUR = 2 endif IF PORTB.7 = 1 THEN DUR = 1 endif IF (BNK1 => 466) OR (BNK2 => 466) THEN FLASH goto MAIN FLASH: if PORTA.4 = 0 or PORTA.5 = 1 THEN GOTO MAIN ENDIF IF PORTA.4 = 1 or PORTA.5 = 0 THEN PORTB.0 = 0 : PORTB.1 = 0 : PORTB.3 = 1 endif IF DUR = 1 THEN PAUSE 1 endif IF DUR = 2 THEN PAUSE 2 endif IF DUR = 4 THEN PAUSE 4 endif IF DUR = 8 THEN PAUSE 8 endif PORTB.0 = 1 : PORTB.1 = 1 : PORTB.3 = 0 pause 1000 GOTO MAIN
I need this to be OR just like it is in the code. Program works perfectly if I have both inputs connected, but I need to be able to fire if there is a 1 on A.4 or if there is a 0 on A.5
Thats my last issue.




Bookmarks