ABEL help needed

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi there

I like to realize a counter, which has an UP and DOWN (and others).
I know, I need a clock for realizing asynchronious reset.
UP and DOWN are triggered by user switches. But I just found a
possiblity for realisation by using an extra Clock-Button - that's a
pretty bad solution!

Can somebody help me and tell me what to change in my ABEL-Code, so I
don't need the Clock-Button??

I use this code

MODULE unicnt

title '6 bit universal counter with parallel load' ;
    X,C,Z = .X., .C., .Z. ;

    D5..D0 pin ; "Data inputs, 4 bits wide
    clk pin ; "Clock input
    rst pin ; "Asynchronous reset
    cnten pin ; "Count enable
    ld pin ; "Load counter with input data value
    up pin ; "Up/Down selector: HIGH selects up
    down pin;

    q5..q0 pin istype 'reg'; "Counter outputs

    data = [D5..D0]; "Data set
    count = [q5..q0]; "Counter set
"mode equations
    MODE = [cnten,ld,up,down]; "Mode set composed of control pins.
    LOAD = (MODE == [ X , 1, X, X ]);"Various modes are defined by
    HOLD = (MODE == [ 0 , 0, X, X ]);"values applied to control pins.
    UP = (MODE ==   [ 1 , 0, 1, 0 ]);"Symbolic name may be defined as
    DOWN = (MODE == [ 1 , 0, 0, 1 ]);"a set equated to a value.

    when LOAD then count := data "Load counter with data
    else when UP then count := count + 1 "Count up
    else when DOWN then count := count - 1 "Count down
    else when HOLD then count := count  "Hold count
    else count := count;
    count.clk = clk;
     "Counter clock input
    count.ar = rst; "Counter reset input




Re: ABEL help needed
Tim schrieb:
Quoted text here. Click to load it

may be i not really understand what you want to do, but any action of
your counter (except reset) can only take place, if there is an counter
clock present. Therefore you need clock for LOAD too    :-(

You could synchronize your input signal with a higher frequency clock
or use asynchronous set and preset to load the counter

this line is redundant:
Quoted text here. Click to load it

regards,  Bertram

Bertram Geiger,  Graz - Austria

Site Timeline