'first version (for backup) --
'send out Serial.
' PILE CODE version 1.0
' portb is our 8 inputs from QPROX: QT113h
' b.0 to b.3 is tops
' b.4 to b.7 is bottoms
define OSC 4
countPeople var byte
sendVal var byte
prevB var byte
time var word
delay var word
delay = 2000 'time before new change occurs in milli secs
pinVar var bit[8]
i var byte
myArray var PORTB
PORTB = 0
TRISB = %11111111
'//////////////////////////////////////////////////////////////////
main:
'count number of people at any moment
countPeople = 0
for i = 0 to 7
IF myArray.0[i] = 1 then
countPeople = countPeople + 1
endif
next
'make a nice button = check if there is a difference
If portb != prevB then
gosub val
prevB = portB
time = 0
else
time = time+1
endif
if time >= delay then
SEROUT2 portc.6, 16468, [dec sendVal, 13]
endif
'SEROUT2 portc.6, 16468, ["people", dec countPeople, 13]
'SEROUT2 portc.6, 16468, ["portB", dec portB, 13]
'SEROUT2 portc.6, 16468, ["sendVal", dec sendVal, 13, 10, 10]
'////////////
val:
select case countPeople
case 0
sendVal = 00 'waiting
CASE 1
sendVal = PORTB
CASE 2
sendVal = PORTB
case is >= 3
sendVal = 87 'party
end select
return
goto main
'//////////////////////////////////////////////////////////////////
'prepare new value to send
'//////////////////////////////////////////////////////////////////
'send out Serial.
' PILE CODE version 1.0
' portb is our 8 inputs from QPROX: QT113h
' b.0 to b.3 is tops
' b.4 to b.7 is bottoms
define OSC 4
countPeople var byte
sendVal var byte
prevB var byte
time var word
delay var word
delay = 2000 'time before new change occurs in milli secs
pinVar var bit[8]
i var byte
myArray var PORTB
PORTB = 0
TRISB = %11111111
'//////////////////////////////////////////////////////////////////
main:
'count number of people at any moment
countPeople = 0
for i = 0 to 7
IF myArray.0[i] = 1 then
countPeople = countPeople + 1
endif
next
'make a nice button = check if there is a difference
If portb != prevB then
gosub val
prevB = portB
time = 0
else
time = time+1
endif
if time >= delay then
SEROUT2 portc.6, 16468, [dec sendVal, 13]
endif
'SEROUT2 portc.6, 16468, ["people", dec countPeople, 13]
'SEROUT2 portc.6, 16468, ["portB", dec portB, 13]
'SEROUT2 portc.6, 16468, ["sendVal", dec sendVal, 13, 10, 10]
'////////////
val:
select case countPeople
case 0
sendVal = 00 'waiting
CASE 1
sendVal = PORTB
CASE 2
sendVal = PORTB
case is >= 3
sendVal = 87 'party
end select
return
goto main
'//////////////////////////////////////////////////////////////////
'prepare new value to send
'//////////////////////////////////////////////////////////////////
請先 登入 以發表留言。