Hi all,
I am currently using an 18M2 chip to control the lighting of three different LEDS based on three different inputs and the chip sends out text to an OLED screen,
I am also using an 08M2 chip as a timer. I am trying to connect the two PICAXEs using serin/out commands so that the OLED screen will display the previous running time before the power was turned off. Is this possible?
18M2:
08M2:
Thanks in advance!
A
I am currently using an 18M2 chip to control the lighting of three different LEDS based on three different inputs and the chip sends out text to an OLED screen,
I am also using an 08M2 chip as a timer. I am trying to connect the two PICAXEs using serin/out commands so that the OLED screen will display the previous running time before the power was turned off. Is this possible?
18M2:
Code:
init: pause 1500 ;wait for disply to initialise
serout b.4,N2400, (254,1) ;clear screen
input b.5
serin b.5,N2400, (b0,b1,b2,b3,b4)
pause 30
serout b.4,N2400, (254,128,"Previous running")
serout b.4,N2400, (254,192,"time: ",b0,b1,b2,b3,b4,"s")
wait 5
serout b.4,N2400, (254,1)
main: if pinc.0 = 0 then goto reda ; move to reda to turn red light on when the current stops
if pinc.1 = 0 then goto redb ; move to redb to turn red light on when the extraction tube stops
if pinc.2 = 0 then goto redc ; move to redc to turn red light on when the magnetic stirrer stops
low b.3 ; blue light off
low b.2 ; red light off
high b.1 ; green light on
serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,129,"All systems OK") ; display "all systems OK" on OLED screen
pause 500 ; pause for 1 second
goto main ; start again
reda: low b.1 ; green light off
high b.2 ; red light on
serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,133,"Current") ; display "current off" on OLED screen
pause 500; pause for 1 second
if pinc.1 = 0 then goto reda1 ; move to reda1 to keep red light on if extraction tube also stops
if pinc.2 = 0 then goto reda2 ; move to reda2 to keep red light on if magnetic stirrer also stops
if pinc.0 = 1 then goto main ; start program again if the current returns
goto reda ; start again
reda1:serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,129,"Current and fan") ; display "current off and extraction fan not working" on OLED screen
pause 500 ; pause for 1 second
if pinc.2 = 0 then goto blue ; move to blue to turn blue light on if the magnetic stirrer also stops
if pinc.0 = 1 then goto main ; start program again if the current returns
if pinc.1 = 1 then goto main ; start program again if the extraction fan starts working again
goto reda1 ; start again
reda2:serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,130,"Current and") ; display "current off and magnetic stirrer not working" on OLED screen
serout b.4,N2400, (254,196,"stirrer")
pause 500 ; pause for 1 second
if pinc.1 = 0 then goto blue ; move to blue to turn blue light on if the extraction fan also stops
if pinc.0 = 1 then goto main ; start program again if the current returns
if pinc.2 = 1 then goto main ; start program again if the magnetic stirrer starts working again
goto reda2 ; start again
redb: low b.1 ; green light off
high b.2 ; red light on
serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,134,"Fan") ; display "extraction fan not working" on OLED screen
pause 500 ; pause for 1 second
if pinc.0 = 0 then goto redb1 ; move to redb1 to keep red light on if current also stops
if pinc.2 = 0 then goto redb2 ; move to redb2 to keep red light on if magnetic stirrer also stops
if pinc.1 = 1 then goto main ; start program again if the extraction fan starts working again
goto redb ; start again
redb1:serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,129,"Current and fan") ; display "current off and extraction fan not working" on OLED screen
pause 500 ; pause for 1 second
if pinc.2 = 0 then goto blue ; move to blue to turn blue light on if the magnetic stirrer also stops
if pinc.0 = 1 then goto main ; start program again if the current returns
if pinc.1 = 1 then goto main ; start program again if the extraction fan starts working again
goto redb1 ; start again
redb2:serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,129,"Fan and stirrer") ; display "extraction fan and magnetic stirrer not working" on OLED screen
pause 500 ; pause for 1 second
if pinc.0 = 0 then goto blue ; move to blue to turn blue light on if the current also stops
if pinc.1 = 1 then goto main ; start program again if the extraction fan starts working again
if pinc.2 = 1 then goto main ; start program again if the magnetic stirrer starts working again
goto redb2 ; start again
redc: low b.1 ; green light off
high b.2 ; red light on
serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,132,"Stirrer") ; display "magnetic stirrer not working" on OLED screen
pause 500 ; pause for 1 second
if pinc.0 = 0 then goto redc1 ; move to redc1 to keep red light on if current also stops
if pinc.1 = 0 then goto redc2 ; move to redc2 to keep red light on if extraction fan also stops
if pinc.2 = 1 then goto main ; start program again if the magnetic stirrer starts working again
goto redc ; start again
redc1:serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,130,"Current and") ; display "current off and magnetic stirrer not working" on OLED screen
serout b.4,N2400, (254,196,"stirrer")
pause 500 ; pause for 1 second
if pinc.1 = 0 then goto blue ; move to blue to turn blue light on if the extraction fan also stops
if pinc.0 = 1 then goto main ; start program again if the current returns
if pinc.2 = 1 then goto main ; start program again if the magnetic stirrer starts working again
goto redc1 ; start again
redc2:serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,129,"Fan and stirrer") ; display "extraction fan and magnetic stirrer not working" on OLED screen
pause 500 ; pause for 1 second
if pinc.0 = 0 then goto blue ; move to blue to turn blue light on if the current also stops
if pinc.1 = 1 then goto main ; start program again if the extraction fan starts working again
if pinc.2 = 1 then goto main ; start program again if the magnetic stirrer starts working again
goto redc2 ; start again
blue: low b.2 ; red light off
high b.3 ; blue light on
serout b.4,N2400, (254,1)
pause 30
serout b.4,N2400, (254,132,"Finished") ; display "finished" on OLED screen
pause 800 ; pause for 3ms
if pinc.0 = 1 and pinc.1 = 1 and pinc.2 = 1 then goto main ; if all three components start working again start program from beginning
goto blue ; start again
Code:
init: enabletime
read b0,w8
serout c.4,N2400, (#w8)
wait 5
main: let w7 = time
write b0,w7
goto main
A