using serin on 08m

Spudgun

New Member
Is there any way of using the Serin pin (leg2) on the 08m as an extra input to detect a switch closure etc?
 

hippy

Technical Support
Staff member
There's one way but it's not really practical nor reliable. A switch between Leg 2 and +V would cause the PICAXE to enter its download mode then after a while would restart the program entirely. By checking the value of a variable or SFR location it would be possible to tell if the program had reset or not. Problems however include -

The PICAXE will ignore the button push while in SERIN and INFRAIN.

The PICAXE will stop working while the button is held, and there may be a significant delay after the button is released to when it starts working again.

The I/O lines will be reset to their defaults.

The program will completely restart from the first code line with variables and SFR locations initialised to zero.

As a 'soft reset' such a button could be used, but as a responsive button as one would normally want it's not that useful.

Code:
PowerOn_Or_SoftReset:
  Do
    If b13 = 0 Then
        Gosub Initialise
        b13 = 1
    End If
    Gosub MainProgram  
  Loop
It's easy enough to experiment with, so you may want to give it a try if it looks appropriate for what you want.
 
Top