Using C.5 on 08M2

SAborn

Senior Member
When pin C.5 is used as an input on the 08m2 and the chip is programmed prior to use, is it still required to have the download resistors (10K and 22K) in circuit with C.5 or can C.5 be just treated as any other input would be.

I had a quick flip through the manual but could not find any reference to this condition.

Pete.
 

Svejk

Senior Member
You can have them both and it is advisable IMO. Otherwise it should work with pullup only.

serial_in.jpg
 

hippy

Technical Support
Staff member
I had a quick flip through the manual but could not find any reference to this condition.
There's probably no explicit statement for C.5 but there is for Serial In which for the 08M2 is the same pin.
 

SAborn

Senior Member
There's probably no explicit statement for C.5 but there is for Serial In which for the 08M2 is the same pin.
So in a nutshell whats the answer??

Is a pulldown required or not, can it be treated as any other input once the chip is programmed.

Is there a need to address the input as an input in the preamble prior to using it as an input ( IE;- let dir = XXXX)
 

hippy

Technical Support
Staff member
A pull-down is required because pin C.5 is also Download Serial In and the 08M2 will not start running its program and may run the program erratically if the input is floating or pulled high.

Once the program is running it can execute a DISCONNECT command which will prevent erratic program operation if Download Serial In subsequently goes high.

Thus the C.5 pin can be brought high with no adverse consequences after a DISCONNECT command is executed, but that pin must be pulled low when the 08M2 is powered on or reset until after DISCONNECT is issued.

C.5 is best used with a push-to-make button from C.5 to +V ( with no pull-up or with a low value R ) with the 10K/22K download circuit in place, or a pull-down replacing that. As long as the button is not pushed during download or when the 08M2 is starting, download and starting will progress as expected. Once the DISCONNECT has been executed, pin C.5 can then be tested to see if the button has been pushed.

There is no need to specify the direction of the pin as, being Download Serial In, the firmware will always maintain it as an input.
 

Attachments

Last edited:

SAborn

Senior Member
Thanks Hippy,

The short answer is ... C.5 needs to be pulled low during bootup (power on) and then it can be used as a input for high logic signals.

That about fits what i thought was correct.

Pete.
 

hippy

Technical Support
Staff member
That's correct, must be kept low at boot-up ( power-on, reset ). As long as that can be assured up until DISCONNECT has been executed then everything will be okay.

The following circuit seems to work to ensure an input to the PICAXE is kept low at the prerequisite times but hasn't been exhaustively tested. The code would be ...

Code:
#Picaxe 08M2
Disconnect
High C.0
Do
  If pinC.5 = 1 Then ...
Loop
 

Attachments

Last edited:

Dippy

Moderator
Would you say then, as a general statement, that you may as well leave the download resistor circuit in place? As said by svejk.
(Assuming the PCB size and massive budget permits :) )
 

hippy

Technical Support
Staff member
Would you say then, as a general statement, that you may as well leave the download resistor circuit in place?
Yes.

As said by svejk.
I wasn't entirely clear on what svejk was saying.


What having the Serial In available as an addressable pin primarily gives is ...

1) The ability to read a button connected between the pin and +V by simply adding to the standard download circuit.

2) Allowing use of SERIN on the pin to use other baud rates than when using SERRXD.
 
Last edited:

SAborn

Senior Member
So is it a requirement that a disconnect command must be used before using C.5 as a input.

There seems to be little information on the use of C.5 in the manuals as i cannot find anything on the operation of C.5 at all.
 

westaust55

Moderator
From the M2 addenda/briefing sheet:

More I/O Pins
The serial download pins can now be used as general purpose pins. The new reset command replaces the need for a
separate external reset pin. Therefore on 18 pin parts leg 4 is now available as another general purpose input pin.
See: serrxd, sertxd, disconnect, reconnect, reset
 

hippy

Technical Support
Staff member
So is it a requirement that a disconnect command must be used before using C.5 as a input.
That's correct. If the DISCONNECT isn't issued the PICAXE will see the pin / Serial In go high and will enter its download mode, twiddle its thumbs until it realises there isn't a download happening, reset and restart the program.

There seems to be little information on the use of C.5 in the manuals as i cannot find anything on the operation of C.5 at all.
I've made a note about adding more information in relation to the use of Serial In as a general purpose input.
 

SAborn

Senior Member
Thanks Hippy,

As per usual your input has proven to be the answer to the problem, the need to use a "disconnect" command was the answer to solve the problem.

It is much appreciated for your response.

Thanks a lot.

Pete.
 

csuckling

New Member
I have just started using the 08M2 for a solar power electricity meter reading project and also had problems using c.5 as an input pin. I've solved it now as noted above using the DISCONNECT command. Please could the documentation be amended to include this requirement, since I could not find reference to it anywhere before searching the forum. There have been several threads on this going back some time - I don't seem to be alone in having had difficulties. Thanks forum members!
 

hippy

Technical Support
Staff member
Welcome to the PICAXE Forum.

Use of the Serial In pin as general purpose input, and the requirement of using the DISCONNECT command, is described in the Interfacing FAQ.
 

csuckling

New Member
Hippy - thanks! But this still doesn't explicitly state (at least to a newbie) that c.5 will not work as an input unless the disconnect command has been included. I would recommend including this point widely, perhaps even in the pinout, or the document that describes the new features of the M2 series of devices. I guess it is obvious if you know how the device works in detail - I just dumbly tried to write code and could not figure out for some time why it didn't work!
 
Top