ho provato anche a fare un listato a parte uguale a quello che ho aggiunto e funziona, ma tutti e due insieme no.
- Codice: Seleziona tutto
program luci1
' Declarations section
const sala as byte[2]=(0,1)
dim k as byte
const bagno as byte[2]=(0,1)
dim ba as byte
const cucina as byte[2]=(0,1)
dim cu as byte
const cam1 as byte[2]=(0,1)
dim ca1 as byte
const cam2 as byte[2]=(0,1)
dim ca2 as byte
dim tempo as byte
dim volt as word
main:
adcon1=$80
trisa=%111111
trisc=%11111111
trisb=0
k=0
ba=0
cu=0
ca1=0
ca2=0
while true
volt=adc_read(0)
delay_ms(10)
'giardino crepuscolare'
if (volt>=0) and (volt<409) then
portb.5=1
end if
if (volt>=409) and (volt<921) then
portb.5=0
end if
'sala'
if (portc=112) and (k<1) then
k=k+1
while portc=112
wend
end if
if (portc=112) and (k>0) then
k=k-1
while portc=112
wend
end if
'bagno'
if (portc=176) and (ba<1) then
ba=ba+1
while portc=176
wend
end if
if (portc=176) and (ba>0) then
ba=ba-1
while portc=176
wend
end if
'cucina'
if (portc=48) and (cu<1) then
cu=cu+1
while portc=48
wend
end if
if (portc=48) and (cu>0) then
cu=cu-1
while portc=48
wend
end if
'cam1'
if (portc=208) and (ca1<1) then
ca1=ca1+1
while portc=208
wend
end if
if (portc=208) and (ca1>0) then
ca1=ca1-1
while portc=208
wend
end if
'cam2'
if (portc=80) and (ca2<1) then
ca2=ca2+1
while portc=80
wend
end if
if (portc=80) and (ca2>0) then
ca2=ca2-1
while portc=80
wend
end if
portb.0=sala[k]
portb.1=bagno[ba]
portb.2=cucina[cu]
portb.3=cam1[ca1]
portb.4=cam2[ca2]
for tempo =0 to 2
delay_ms(1000)
next tempo
wend
end.
programma di prova funzionante
- Codice: Seleziona tutto
program crepa
dim volt as word
main:
adcon1=$80
trisa=%111111
trisb=0
while true
volt=adc_read(0)
delay_ms(10)
'giardino crepuscolare'
if (volt>=0) and (volt<409) then
portb.5=1
end if
if (volt>=409) and (volt<921) then
portb.5=0
end if
wend
end.

Elettrotecnica e non solo (admin)
Un gatto tra gli elettroni (IsidoroKZ)
Esperienza e simulazioni (g.schgor)
Moleskine di un idraulico (RenzoDF)
Il Blog di ElectroYou (webmaster)
Idee microcontrollate (TardoFreak)
PICcoli grandi PICMicro (Paolino)
Il blog elettrico di carloc (carloc)
DirtEYblooog (dirtydeeds)
Di tutto... un po' (jordan20)
AK47 (lillo)
Esperienze elettroniche (marco438)
Telecomunicazioni musicali (clavicordo)
Automazione ed Elettronica (gustavo)
Direttive per la sicurezza (ErnestoCappelletti)
EYnfo dall'Alaska (mir)
Apriamo il quadro! (attilio)
H7-25 (asdf)
Passione Elettrica (massimob)
Elettroni a spasso (guidob)
Bloguerra (guerra)



