Okay so then here is an updated code:
'----------Code for the Front Left, Front Right, Back Left, and Back Right
SYMBOL PORT_PIN = PORTB
X VAR BYTE ' For loop & bit index pointer
ADCON1 = 7 ' All digital
PORTB = 0 ' Clear port pins
TRISB = 0 ' Make them all outputs
Main:
FOR X = 0 TO 7
PORT_PIN.0[X] = 1 ' Set all pins high
PAUSE 200
NEXT X
GOTO Off
Off:
ADCON1 = 7 ' All digital
PORTB = 0 ' Clear port pins
PORTC = 0
TRISB = 0 ' Make them all outputs
TRISC = 0
FOR X = 0 TO 7
PORT_PIN.0[X] = 0 ' Set all pins low
PAUSE 200
NEXT X
GOTO Main
'----------Code for Both Sides
SYMBOL PORT_PIN = PORTB
X VAR BYTE ' For loop & bit index pointer
ADCON1 = 7 ' All digital
PORTA = 0
PORTB = 0 ' Clear port pins
PORTC = 0
TRISB = 0 ' Make them all outputs
TRISC = 0
Wait:
INPUT PORTA.0
IF PORTA.0 = GOTO Main
GOTO Wait
Main:
FOR X = 0 TO 15
PORT_PIN.0[X] = 1 ' Set all pins high
PAUSE 200
NEXT X
GOTO Off
Off:
ADCON1 = 7 ' All digital
PORTB = 0 ' Clear port pins
PORTC = 0
TRISB = 0 ' Make them all outputs
TRISC = 0
FOR X = 0 TO 15
PORT_PIN.0[X] = 0 ' Set all pins low
PAUSE 200
NEXT X
GOTO Main
-------------------------------------------------
How does that look? For the front and back ones I only need 6 outputs but I need 16 for the sides. I hope I did that INPUT thing right. I assumed that PORT_PIN would still equal PORTB since I'm only using PORTA for the INPUT. Did I do everything correct? Also, I am using a 16F876 so all PORTB and PORTC pins can be outputs, however PORTA.6 and PORTA.7 are unimplemented so that is why I am starting with PORTB.
Thanks again.
-Brad
Bookmarks