Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:03 18 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : (PX) dual counter

Author Message
Tinker

Guru

Joined: 07/11/2007
Location: Australia
Posts: 1904
Posted: 11:37pm 24 May 2016
Copy link to clipboard 
Print this post

Hi, this is my first post on this forum section.

I built a dual counter by programming a 20M2 picaxe chip to output:

binary 0000 to 1111 output with a distinctive pause between each step (to allow relay contacts to settle)
And, simultaneously, BCD 00001 to 10110 output to indicate on a 2 digit 7 segment display which relay is on.

The counters run through this cycle indefinitely, starting again at the beginning.

All works well but for some strange reason the count is reset on a quite random fashion. Often a long time with no reset or sometimes 2 or 3 resets in one 16 step cycle.

Its not a life threatening problem but I really would like to know why this happens.

A clue may be: the LED connected via a 330R at the chip output pin flashes briefly when a reset occurs.

The chip has bypass capacitors on the 5V line.

Thanks for any suggestions.Edited by Tinker 2016-05-26
Klaus
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 12:02am 25 May 2016
Copy link to clipboard 
Print this post

Are the 7-seg displays LED types?
If so, are you driving the segments directly, OR via 'buffers' of some type?

If driving directly, are too many lit segments approaching the maximum drive capability and hence resetting things?

You say the 'count is reset' - but does this mean the pickaxe is actually reset too?

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Tinker

Guru

Joined: 07/11/2007
Location: Australia
Posts: 1904
Posted: 01:47am 25 May 2016
Copy link to clipboard 
Print this post

Thanks for taking an interest in my little conundrum.

yes, they are LED 7-seg displays. The LSD is driven via a 4511 BCD to 7-seg decoder chip. The MSD is driven via a transistor since only #1 (segment b & c) is required.

The 20M2 chip does not have a reset pin, sorry about my poor language usage.
What I meant is:
the program starts with "main"
the last line is "goto main"

Lets say the count has progressed to: 1001 BCD & 1000 binary. For some reason it randomly terminates there and starts again at 0001 & 0000, or this can happen at any other count step. There is no regular pattern to this behavior. The 20M2 chip is new.

I do not know if the picaxe chip "resets" or hiccups, all I can observe is the unexpected change of the 7 segment display and the brief flash of the LED connected to pin 19 (out) of the 20M2 picaxe chip.



I hope that explains it.Edited by Tinker 2016-05-26
Klaus
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 02:31am 25 May 2016
Copy link to clipboard 
Print this post

Can you post a schematic and/or your code?

I need to confirm the correlation between your BCD and binary values.

In your original post you talk about binary from 0000 to 1111 (decimal 0 to 15) and BCD from 0001 to 10110 (decimal 1 to 16 if using 4bit per digit)

I therefore assume you want to display '1' to '16'.

What is the LED that briefly flashes when the pickaxe 'resets'? Is it the MSD (left hand '1' digit) driven by the transistor?

Hopefully we can shed some light as to what is occurring . . . .

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Tinker

Guru

Joined: 07/11/2007
Location: Australia
Posts: 1904
Posted: 06:32am 25 May 2016
Copy link to clipboard 
Print this post

Yes I can but the schematic is on my other laptop so I'll post it tomorrow.

I have wired in a separate LED (nothing to do with the MSD (LEFT) and LSD (right) 7 seg display.

That separate LED is connected to pin 19 (out) via a 330 ohm resistor to ground. Its purpose is to show data communication when the picaxe chip program is uploaded (telling me something is happening ).

I'll list a code extract below, its very repetitive so just the beginning should suffice:

#picaxe 20m2

let dirsB=%00011111 ;set pins B.0 to B.4 as output

let dirsC=%00001111 ;set pins C.0 to C.3 as output

symbol EN=C.4 ;disables relays to settle switching time

Main:

gosub enable

test_0:

pinsB=%00000001 ;display cell #1

pinsC=%00000000 ; turn on cell #1 relays

wait 3 ; samples & displays cell voltage on digital display

gosub enable ;turn off all relays & cell display for 0.5 seconds


test_1:

pinsB=%00000010 ;cell#2

pinsC=%00000001

wait 3

gosub enable


the program tests each cell as above to cell 16 from here.....

test_15:

pinsB=%00010110 ;cell # 16

pinsC=%00001111

wait 3

goto main


enable:

high EN

pause 750

return


I hope that gives you a better idea what the program does.
Klaus
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 07:05am 25 May 2016
Copy link to clipboard 
Print this post

Not sure yet about the relay(s). Do you have four connected to Port C?

My guess at the moment (without seeing the schematic) is that the relay(s) are somehow causing 'noise' on the supply line resulting in the Pickaxe to reset itself.

I will be able to make a 'better' assessment once I see the schematic.

Do you have 'breakdown diodes' connected across the relay coils?

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 10:02am 25 May 2016
Copy link to clipboard 
Print this post

What is on pinsC? A 74xx4514 or 74xx154 perhaps? Do all chips have decoupling capacitors? Does the error occur while the system is holding a value or while changing to a new value? Ie, while relays are clicking on or off.
Visit Vegipete's *Mite Library for cool programs.
 
Tinker

Guru

Joined: 07/11/2007
Location: Australia
Posts: 1904
Posted: 12:57am 26 May 2016
Copy link to clipboard 
Print this post

Thank you WW and vegipete for your suggestions.

I think I have solved the problem.

I just put a shorting link from the programming 'IN' terminal to ground.
No hiccups while I watched the counters stepping through their cycle.Edited by Tinker 2016-05-29
Klaus
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024