Setup:
1. LCD/keypad module with 28x1 @ 8MHz (setfreq m8), will be the interruptor of
2. Main controller module with 40x1 @ 8MHz (setfreqm8).
Both setup to send/receive via Hserin/Hserout.
The 28x1 via portc 7/portc 6.
The 40x1 via portc 7/portc 6 (as per pinout diagrams).
Circuit:
28x1-----------------40x1
portc 4(out)----------input 6/leg29(in)
portc 5(in)-----------output 1/leg34(out)
Gnd(0V)-------------Gnd(0V)----------------power 0V
The voltage on 28x1 portc 4(out) when set high=4.95V. The pin is low (0V) beforehand.
This voltage appears on 40x1 input 6 when 28x1 pin goes high(also 4.95V).
Code for 28x1:Initialising
Code for 28x1 to generate interrupt and send data when interrupt is acknowledged:
Code for 40x1 to initialise:
Code or 40x1 when interrupt occurs:
Both Interrupt: subroutines are the last routines in both programs(End of program as per Basic Command Manual).
What am I doing wrong here ?
1. LCD/keypad module with 28x1 @ 8MHz (setfreq m8), will be the interruptor of
2. Main controller module with 40x1 @ 8MHz (setfreqm8).
Both setup to send/receive via Hserin/Hserout.
The 28x1 via portc 7/portc 6.
The 40x1 via portc 7/portc 6 (as per pinout diagrams).
Circuit:
28x1-----------------40x1
portc 4(out)----------input 6/leg29(in)
portc 5(in)-----------output 1/leg34(out)
Gnd(0V)-------------Gnd(0V)----------------power 0V
The voltage on 28x1 portc 4(out) when set high=4.95V. The pin is low (0V) beforehand.
This voltage appears on 40x1 input 6 when 28x1 pin goes high(also 4.95V).
Code for 28x1:Initialising
Code:
Init: 'initialize here
outpins=%00000000
high 7
portc = %00000000
setfreq m8 'freq @ 8mhz for 9600bd comms
setint %00100000 , %00100000 'interupt on pin 5 when high
Code:
WireData: 'send new alarm setpoint to Main
'-----------------
'ON 40X1 MAIN
'int-out output pin 1
'int-in input pin 6
'hserin portC 7
'hserout portC 6
'-----------------
temb2=pin5 'pin5 = low normally
high portc 4 'output interrupt to Main
do until temb2<>0 'loop until interrupt confirm
temb2=pin5
loop
low portc 4 'stop inter. signal
sertxd("pin 5 = ",#temb2)
pause 10 'wait for main to get ready
if charcnt=218 then 'deg C setpoint
hserout 0,("c") 'send what is comming
pause 20
hserout 0,(temb1) 'send ^C new setpoint="c"
end if
if charcnt=226 then 'RH% setpoint
hserout 0,("r") 'send what is comming
pause 20
hserout 0,(temb1) 'send RG new setpoint="r"
end if
return
Code:
Init:
hsersetup B9600_8,%00
setint %01000000,%0100000
goto main
Code:
Interrupt: 'check for interrupt from keypad module
tempb1=255
high 1 'signal int.request received
pause 50
low 1 'stop signal
hserin [500,main],200,1
pause 20
read 200,tempb2
select case tempb2
case = "c"
hserin [500,main],201,1
pause 20
read 201,tempb1
gosub ChkForUpd_T
case = "r"
hserin [500,main],202,1
pause 20
read 202,tempb1
gosub ChkForUpd_H
case = "d"
hserout 0,(t1,rh1,news,speed)
end select
setint %01000000,%0100000
sertxd("Interrupt request")
return
What am I doing wrong here ?
Last edited: