jamie_s
- 12th July 2006, 08:50
For some reason the following code has no effect on outputs due to the pin labels:
InpA VAR PortB.4
InpB VAR PortB.5
InpC VAR PortB.6
InpD VAR PortB.7
LedA VAR PortA.2
LedB VAR PortA.3
LedC VAR PortA.4
LedD VAR PortA.5
RlyA VAR PortA.6
RlyB VAR PortA.7
RlyC VAR PortA.0
RlyD VAR PortA.1
StatusA VAR byte ' Port A Status Flag
StatusB VAR byte ' Port B Status Flag
StatusC VAR byte ' Port C Status Flag
StatusD VAR byte ' Port D Status Flag
CurrentPort VAR byte ' Current Port
StatusA = 0
StatusB = 0
StatusC = 0
StatusD = 0
LedA = 0
LedB = 0
LedC = 0
LedD = 0
CurrentPort = 1
Goto SetActivePort
checkports:
If InpA = 0 then
pause 50
If InpA = 0 then
StatusA = 0
Low LedA
endif
Else
StatusA = 1
High LedA
endif
If InpB = 0 then
pause 50
If InpB = 0 then
StatusB = 0
Low LedB
endif
Else
StatusB = 1
High LedB
endif
If InpC = 0 then
pause 50
If InpC = 0 then
StatusC = 0
Low LedC
endif
Else
StatusC = 1
High LedC
endif
If InpD = 0 then
pause 50
If InpD = 0 then
StatusD = 0
Low LedD
endif
Else
StatusD = 1
High LedD
endif
If i Use the following:
Goto SetActivePort
checkports:
If portb.4 = 0 then
pause 50
If portb.4 = 0 then
StatusA = 0
Low PORTB.3
endif
Else
StatusA = 1
High PORTB.3
endif
If PORTB.5 = 0 then
pause 50
If PORTB.5 = 0 then
StatusB = 0
Low PORTB.2
endif
Else
StatusB = 1
High PORTB.2
endif
If PORTB.6 = 0 then
pause 50
If PORTB.6 = 0 then
StatusC = 0
Low PORTB.1
endif
Else
StatusC = 1
High PORTB.1
endif
If PORTB.7 = 0 then
pause 50
If PORTB.7 = 0 then
StatusD = 0
Low PORTB.0
endif
Else
StatusD = 1
High PORTB.0
endif
it seems to work fine,
is there anything obvious that i have missed?
InpA VAR PortB.4
InpB VAR PortB.5
InpC VAR PortB.6
InpD VAR PortB.7
LedA VAR PortA.2
LedB VAR PortA.3
LedC VAR PortA.4
LedD VAR PortA.5
RlyA VAR PortA.6
RlyB VAR PortA.7
RlyC VAR PortA.0
RlyD VAR PortA.1
StatusA VAR byte ' Port A Status Flag
StatusB VAR byte ' Port B Status Flag
StatusC VAR byte ' Port C Status Flag
StatusD VAR byte ' Port D Status Flag
CurrentPort VAR byte ' Current Port
StatusA = 0
StatusB = 0
StatusC = 0
StatusD = 0
LedA = 0
LedB = 0
LedC = 0
LedD = 0
CurrentPort = 1
Goto SetActivePort
checkports:
If InpA = 0 then
pause 50
If InpA = 0 then
StatusA = 0
Low LedA
endif
Else
StatusA = 1
High LedA
endif
If InpB = 0 then
pause 50
If InpB = 0 then
StatusB = 0
Low LedB
endif
Else
StatusB = 1
High LedB
endif
If InpC = 0 then
pause 50
If InpC = 0 then
StatusC = 0
Low LedC
endif
Else
StatusC = 1
High LedC
endif
If InpD = 0 then
pause 50
If InpD = 0 then
StatusD = 0
Low LedD
endif
Else
StatusD = 1
High LedD
endif
If i Use the following:
Goto SetActivePort
checkports:
If portb.4 = 0 then
pause 50
If portb.4 = 0 then
StatusA = 0
Low PORTB.3
endif
Else
StatusA = 1
High PORTB.3
endif
If PORTB.5 = 0 then
pause 50
If PORTB.5 = 0 then
StatusB = 0
Low PORTB.2
endif
Else
StatusB = 1
High PORTB.2
endif
If PORTB.6 = 0 then
pause 50
If PORTB.6 = 0 then
StatusC = 0
Low PORTB.1
endif
Else
StatusC = 1
High PORTB.1
endif
If PORTB.7 = 0 then
pause 50
If PORTB.7 = 0 then
StatusD = 0
Low PORTB.0
endif
Else
StatusD = 1
High PORTB.0
endif
it seems to work fine,
is there anything obvious that i have missed?