Reading SRQ status from software

fastgrandad

New Member
I want to use the 18M2 hardware latch and to be able to read the SRQ status (0 or 1) from the program. All attempts have so far failed, e.g. using let b1=pinC.3 etc. I could connect the SRQ to a spare input pin and read it that way but I'd rather do it from the software if possible, not least as it would be good to be able check it all out in the simulator. The simulator currently shows the status of pin C.3 changing as the latch is set/reset but not any variable assigned to it. Is this possible?
 

fastgrandad

New Member
Thanks. I gave it a try, reading the SRQ pin C.3 as an input rather than an output and still no joy. I copied the code from the other posting and that didn't work as expected either. Maybe its the simulation that's the problem and it works ok in the flesh. I'll have to build one and try it unless someone can tell me otherwise. I can always route the SRQ back to a spare input so I'm sure I can make it work (ever hopeful!)

Paul
 

westaust55

Moderator
All attempts have so far failed, e.g. using let b1=pinC.3 etc.
that is looking at the status of the inputs as opposed to the output pins in terms of PIC internals and Latch registers.


Untested as I am currently not near a PICAXE chip however, have you tried

LET b0 = OutpinsC

Then SQR status should/might be available in bit variable bit3.
 

fastgrandad

New Member
That doesn't work on the simulator and none of the outpinsC or pinsC values on the simulation table change, and even though 'C.3' on the top-left schematic changes its not being read.

In the absence of an answer I'll have to make up a test unit and try it for real with a test program.
 

westaust55

Moderator
I have just tried on an actual 18M2 and it does work

Code:
SRLatch %10001000, %10000000
Pause 1000
Main
SRSet
b0 = outpinsC
If bit3 = 1 Then
High B.4
Else
Low B.4
ENDIF
Pause 2000
SRReset
b0 = outpinsC
If bit3= 1 Then
High B.4
Else
Low B.4
ENDIF
Pause 2000
GOTO main
Output B.4 Follows the state of the SRQ pin.
Apologies code not well formatted but using iPhone as forum access via ISP is out :(

For hippy/Technical,
there is a bug in PE 5.5.5 simulator, as while the SRQ pin emulates going high and low, the outpinsC command does not read the state of the SRQ whereas in actual PICAXE it does.
Same applies if I simulate as a 14M2 or a 20M2 or 28/40X2.
 
Last edited:

hippy

Technical Support
Staff member
For hippy/Technical,
there is a bug in PE 5.5.5 simulator, as while the SRQ pin emulates going high and low, the outpinsC command does not read the state of the SRQ whereas in actual PICAXE it does.
Same applies if I simulate as a 14M2 or a 20M2 or 28/40X2.
Thanks. I've made a note of it.
 
Top