Can someone explain this I/O behavior on 20M2?

chipwich

Member
I was helping a student with a program to control a tri-color LED, when I ran across some unexpected behavior. The issue is that SERRXD turns pin C.5 on the 20M2 to an input. This was confusing, since in this program, pin C.5 is already being used as an output. My understanding from the manual and my own experience is that SERRXD takes input from the serial pin (pin #2 of 20), and should not be affecting of the general I/O pins. SERIN should be used for serial I/O on the general pins.

So can someone explain what is going on? For reference, here is the code. It is controlled via the PC serial terminal window. The program works exactly as expected for the RedLED and BlueLED, but the GreenLED on C.5 turns off as soon as the SERRXD command is re-issued.

Thanks in advance for any advice on this issue.

Code:
symbol Color=b0

symbol RedLED=C.3
symbol GreenLED=C.5
symbol BlueLED=C.2


init:
    sertxd("type (r)ed, (g)reen, (b)lue re(c)nnect,")

main:
    serrxd[1000, main], Color

    if Color="R" or Color="r" then
        sertxd ("Red ")
        high RedLED
        low BlueLED
        low GreenLED
    elseif Color= "G" or Color= "g" then 
        sertxd("Green ")
        high GreenLED
        low RedLED
        low BlueLED
    elseif Color= "B" or Color= "b" then
        sertxd("Blue ")
        high BlueLED
        low RedLED
        low GreenLED
    elseif Color= "C" or Color= "c" then
        sertxd("Stopping and Reconnecting")
        low BlueLED 
        low RedLED 
        low GreenLED 
        reconnect
        end
    endif

    pause 2000

    goto main
 
Last edited:

westaust55

Moderator
Could not find anything wrt SERRXD but from the firmware.txt file, the following is known wrt the 20M2:

*** PICAXE-20M2 ***
The PICAXE-20M2 firmware is implemented on a PICAXE20M2.
BASE FIRMWARE CODE:8
VA FIRST PUBLIC RELEASE
Known issue for future release:
PAUSE DOES NOT WORK CORRECTLY DURING INTERRUPT ON A MULTI-TASK PROGRAM (USE PAUSE_INT INSTEAD)
USE OF THE CALIBADC COMMAND SETS PIN C.7 TO INPUT (IF CURRENTLY OUTPUT)
USE OF THE READINTERNALTEMP COMMAND SETS PIN C.5 TO INPUT (IF CURRENTLY OUTPUT)
 

chipwich

Member
Could not find anything wrt SERRXD but from the firmware.txt file, the following is known wrt the 20M2:
Thanks, Westy. Perhaps this is similar to CALIBADC and READINTERNALTEMP output->input issues.

Assuming that my understanding is correct (never a solid assumption!), and this is unexpected behavior, will it be noted from this thread for capture in an issue-tracking system, or is there another process?
 

nick12ab

Senior Member
Thanks, Westy. Perhaps this is similar to CALIBADC and READINTERNALTEMP output->input issues.
Possibly. My view on it is that it has accidentally been left in code copied and pasted from the 18M2/14M2/08M2 which all have C.5 as a "fixed input" and the fixedinputness is a software limitation except for the 18M2. Rev-Ed make the firmware constantly check the TRIS registers to make sure you can't get away with using C.5 as an output on the 08M2/14M2 even if you have used the disconnect command.

Assuming that my understanding is correct (never a solid assumption!), and this is unexpected behavior, will it be noted from this thread for capture in an issue-tracking system, or is there another process?
No need to move this thread. Rev Ed personnel (ie hippy or Technical) will still see it here and respond accordingly.
 
For what it's worth, I just ran into this same issue when I used a 20M2 in a circuit that I originally designed for a 20X2. When I check the firmware version, it says:

Firmware version 8.a
(PICAXE-20M2 Firmware version A)

Chuck
 
Top