The DISCONNECT command doesn't seem quite right?

OLDmarty

Senior Member
Hi All,

I've recently tried the DISCONNECT command on my 14M2 for the first time as i needed to use the Serin/C.5 pin as a standard digital input.

At the beginning of my code i use:
Code:
Pause 3000     ; allow 3 seconds before disconnecting, just in case i need to re-program the 14M2
disconnect      ; disable the Serin mode, to use C.5 as a digital input.

However, i noticed that C.5 needs to be held LOW during bootup for my program to run correctly.
If pin C.5 is high/floating, then my code does not work.

I found on google/AI that it states that the C.5 pin does need to be held low during bootup, which (to me) is unacceptable as i cannot always guarantee that C.5 will be in a low state when that signal is coming from another logic chip which might be randomly hi/low during the instance that the picaxe bootsup.

At the moment, Pin C.5, C.4, C.3, C.2 have 4 bits from a hexadecimal rotary switch for testing purposes, but later, those 4 bits will be read from an external logic device.
I noticed that:
If the hex switch is in position 0-7, the picaxe/program will boot and run correctly, as Pin C.5 is LOW and boots correctly. (Hex switch MSB=low)
If the hex switch is in position 8-15, the picaxe/program will *NOT* boot and run correctly, as Pin C.5 is now HI. (Hex switch MSB=high)

Am i completely missing something? or is it true that pin C.5 (even though it's disconnected) still actually requires a LOW (or pulldown resistor) to boot correctly?



Regarding the DISCONNECT command, I also noticed that if i try to re-program the 14M2 (after it's been disconnected), then it won't allow programming as it's still disconnected, so i have to briefly break the power to the 14M2 before the programmer can access the chip again.

I *think* i need to try this code at the beginning??:
Code:
reconnect       ; Reconnect the programming access, since the chip was previously disconnected....
Pause 3000     ; allow 3 seconds to check if the programmer is trying to update the chip (no need to remove power now?)
disconnect      ; NOW disable the Serin mode, to use C.5 as a digital input and let the chip bootup and run its program....



with thanks in advance...
 
The reconnect command in your suggested code is superfluous: the chip boots (powers) up in this mode anyway.

Put simply, pin C.5 must be pulled low until the disconnect command is executed. Note that I used the word "pulled" low, rather than "held" low. For me, using a resistor of up to 33k (usually the 'normal' 22k + 10k combination) to the 0v rail on the pin is the simplest solution.

Designing my circuit around this, once the disconnect command is executed, I have an input that can be used as an active high input. If your project demands the input to be active low, then add a PNP transistor between C.5 and the +5v rail and use its base as an inverting input. Having said that, I'd be using a bigger PICAXE chip!
 
Hi IP,

Sadly once the disconnect is programmed into the chip, it NEVER gets detected by the picaxe software until i power-cycle the chip.
So, the reconnect is not superflous at all, the chip needs to be reconnected to receive updates.

My 4 inputs are active HI, but C.5 doesn't like being HI at power up.

I need to use the smaller physical chip, as my 20X2 solution is too big for the project.

Anyhoo...
 
Hi,
Am i completely missing something? or is it true that pin C.5 (even though it's disconnected) still ..actually requires a LOW (or pulldown resistor) to boot correctly?
Yes! But I have an automatic (simple hardware) solution which (purely by coincidence) I hope to post in a new thread within a day or so (look for AXE033 Emulator). ;)

Similarly, if the program has a "planned" ending or pause, I put in a RECONNECT just before, so that there's no need to use the "Hard Reset" procedure if the program needs to be updated.

ADDED: My AXE033 thread is now posted, but the text is quite complex and cryptic in places to fit in the 10,000 characters limit, but there should be some relevant information. For your application, look at my schematic diagram :

Connect the Anode of D1 to the Programming input (C.5) and the Cathode to your desired Logic Input. It can't initiate a Reset/Programming cycle because the diode blocks a High level. Note that the Logic Input must have a Pull-Down capability of less than a few kOhms (i.e. a mechanical switch just to the supply rail is no good). To allow the Program to read this input, start the program with a DISCONNECT and then activate the internal Weak Pullup with a POKESFR $8C , %00100000 (untested but the WPU appears to be on the 14M2's Internal Port A.5 ).

Also connect R3 (> 47k) , R2 and the Programming Socket as normal/shown. That should be able to program the 14M2 as usual, provided that 1) A DISCONNECT (without a subsequent RECONNECT) has NOT been executed since the last power-down and 2) the "Logic Input" (through D1) is Idling HIGH. If these conditions cannot be guaranteed, then it may be possible to adjust the analogue resistor values to give the desired "priority" (note the Weak Pullups are quite high at around 35 k).

Cheers, Alan.
 
Last edited:
Hi IP,

Sadly once the disconnect is programmed into the chip, it NEVER gets detected by the picaxe software until i power-cycle the chip.
So, the reconnect is not superflous at all, the chip needs to be reconnected to receive updates.

My 4 inputs are active HI, but C.5 doesn't like being HI at power up.

I need to use the smaller physical chip, as my 20X2 solution is too big for the project.

Anyhoo...
Yes, you either need a power cycle or perform a "reconnect" before downloading a new program. You haven't said why power cycling is not an option, since the PICAXE will be out of action during the download anyway.

If you are using several inputs, it may be possible to have your program regularly poll for a combination of input states that would not normally occur when the chip is simply running your desired routine. You would force this input pattern to occur (via external hardware) when you want a new download to occur - Eg could you have all 4 inputs go high at once? When this combination of input states occurs, your program executes a reconnect command and waits for the new download to occur.
 
Hi Guys,

I haven't used a reconnect command at the end/exit of my program, because it's basically an infinite loop.
I read 4bit binary/hex data on the 4 inputs, and send out 8 segment bits for a 7-seg display, simple, but looping and watching live 4bit data to update the 7-Seg display all day long..

If i add a reconnect command into the loop, it'll keep interfering with input pin C.5 (SERin) and disrupt the overall operation of the program.

I think i just have to live with power-cycling the chip *IF* i ever need to update the program, but it's really a "set & forget" program.
Then of course, there's the pulldown at bootup issue.

I might end up using a 20M2/X2 SMD chip to keep the small footprint maintained, which is why i used the small 14M2 in the first place.
 
I was going to offer you a couple of 7447 from the late 70's, but I'm in the UK and I see you're in Oz. If you're only after BCD then you may find the not quite so old 74LS47 quite a bit cheaper than a PICAXE, dependent on delivery charges. Not as much flexibility or fun as PICAXE, so you wouldn't get hex if that's what you're after, but it's nice to see old gear being used :)
 
I was going to offer you a couple of 7447 from the late 70's, but I'm in the UK and I see you're in Oz. If you're only after BCD then you may find the not quite so old 74LS47 quite a bit cheaper than a PICAXE, dependent on delivery charges. Not as much flexibility or fun as PICAXE, so you wouldn't get hex if that's what you're after, but it's nice to see old gear being used :)

Thanks for your offer, but HEX is often the way for me.
I don't mind using old tech at all, in fact, i still build a LOT of my projects with TTL/Cmos chips, just to enjoy "the old way of doing things", then i rebuild the same project using just 1 picaxe for comparison.

My fave HEX to 7-Seg chip, the old TTL 9368 is often hard to find or beyond expensive when sellers consider them to be "collectible" lol.
My other pet-hate towards the 9368 is that it doesn't use tails on the 6 or 9, so it's not always clear if the display is showing me a "6" or a "b"(hex).
I've fixed that problem in my picaxe version, by adding the tails onto 6 & 9, now i'm happy ;-)
 
Hi,
..... send out 8 segment bits for a 7-seg display, simple, but looping and watching live 4bit data to update .....

I might end up using a 20M2/X2 SMD chip to keep the small footprint maintained, which is why i used the small 14M2 in the first place.

It may depend on what you have, or have already built, but there should be several ways to do what you desire with a polling loop in a 14M2.

Firstly, a seven-segment display needs only seven pins, not 8 (unless you need the decimal point) ? If you do require all 8 pins, then there might be a solution based on "multiplexing" one or more of the pins, although this is generally more useful with multiple digits or unrelated inputs. It's common to use (one or more of) the "segment" output signals/pulses to "Strobe" data onto (one or more of) the input pins. But for a full N x M array it's usually necessary to employ a row of N or M (external) diodes (which might be LEDs) to prevent the row/column of control lines all shorting together.

The CONNECTed / DISCONNECTed status doesn't need to be constant throughout the whole polling loop. One solution could be to connect one of the segment drivers (or DP) to the "common" of the Hex switch. Then, the program can be RECONNECTed for a brief period in each polling loop, whilst the display is inactive. Also, the switch in the standard 3.5 mm programming socket could be arranged to connect the related Hex switch pin to C.5 only when the Programming Lead is not plugged in.

Yet another possibility is to create a 16-level Analogue voltage (to apply to one ADC input) from the Hex switch, using a "weighted" set of resistors (typically consecutive "power of two") or a Resistor Ladder (only one or two resistor values required). Then a "17th level" could signal to the program to issue a RECONNECT to allow Programming. Or my usual solution is to send a character (any, or one specific) to a SERIN or SERRXD (or POKESFR/PEEKSFR the buffer, $79 ), This could be quite brief within each polling pass, used prior to programming, to indicate that a RECONNECT is desired.

Cheers, Alan.
 
Back
Top