I changed the code to
DEFINE OSC 4
Input PORTA.2
High PORTA.2
Pause 50
Input PORTB.2
Input PORTB.3
Input PORTB.4
Input PORTB.5
Input PORTB.6
Input PORTA.4
Horncount VAR BYTE
CounterStop VAR BYTE
SWITCH:
Pause 250
IF PORTA.4 = 1 Then End
IF (PORTB.2 = 0) AND (PORTB.3 = 0) AND (PORTB.6 = 0) AND (PORTB.4 = 0) AND (PORTB.5 = 1) Then CounterStop = 9: GoTo Horn_Loops
IF (PORTB.2 = 0) AND (PORTB.3 = 0) AND (PORTB.6 = 0) AND (PORTB.4 = 1) AND (PORTB.5 = 1) Then CounterStop = 0: GoTo Horn_Loops
IF (PORTB.2 = 1) AND (PORTB.3 = 0) AND (PORTB.6 = 0) AND (PORTB.4 = 0) AND (PORTB.5 = 1) Then CounterStop = 1: GoTo Horn_Loops
IF (PORTB.2 = 1) AND (PORTB.3 = 0) AND (PORTB.6 = 0) AND (PORTB.4 = 1) AND (PORTB.5 = 1) Then CounterStop = 2: GoTo Horn_Loops
IF (PORTB.2 = 0) AND (PORTB.3 = 0) AND (PORTB.6 = 1) AND (PORTB.4 = 0) AND (PORTB.5 = 1) Then CounterStop = 3: GoTo Horn_Loops
IF (PORTB.2 = 0) AND (PORTB.3 = 0) AND (PORTB.6 = 1) AND (PORTB.4 = 1) AND (PORTB.5 = 1) Then CounterStop = 4: GoTo Horn_Loops
IF (PORTB.2 = 1) AND (PORTB.3 = 0) AND (PORTB.6 = 1) AND (PORTB.4 = 0) AND (PORTB.5 = 1) Then CounterStop = 5: GoTo Horn_Loops
IF (PORTB.2 = 1) AND (PORTB.3 = 0) AND (PORTB.6 = 1) AND (PORTB.4 = 1) AND (PORTB.5 = 1) Then CounterStop = 6: GoTo Horn_Loops
IF (PORTB.2 = 0) AND (PORTB.3 = 1) AND (PORTB.6 = 0) AND (PORTB.4 = 0) AND (PORTB.5 = 1) Then CounterStop = 7: GoTo Horn_Loops
IF (PORTB.2 = 0) AND (PORTB.3 = 1) AND (PORTB.6 = 0) AND (PORTB.4 = 1) AND (PORTB.5 = 1) Then CounterStop = 8: GoTo Horn_Loops
GoTo SWITCH
Horn_Loops:
For Horncount = 0 TO CounterStop
PulsOut PORTA.2, 50000
Pause 500
Next Horncount
End
It did compile but I have another problem now. Its is with the circuit. I have attached a picture of the schematic. In it with with everything hooked up U2 overheats. Without the PIC in it it has a five volt output.




Bookmarks