Using Arduino > LEDs and Multiplexing

Need Help 4-bit Binary Counter With Parallel Load

(1/3) > >>

iwanna4get:
So i got the binary counter working. Now I just have to take and input (Load = HIGH) and if i turn on count it will continue counting from there..,

So i was thinking that i was thinking that I would take the 4 bit input then turn it to decimal and give the value to count.. is there anyway to do this?

I was thinking putting the HIGH or LOW values in an array or concatenate each input value and convert it to decimal.

If so how to convert from int to string, string to bit and then from string to int.

marco_c:
Maybe it is me, but I have no idea what you are talking about.

Can you post your circuit and any code you may have so we can see what you are trying to do. I have a feeling that you are overcomplicating something here.

Grumpy_Mike:
No it is not just you, no idea what the problem is.
I do know you should not be using a string.
I suspect it might be a four digit counter and not a four bit one.

iwanna4get:
Ok first I got a binary counter program in arduino (with the help of some arduino topics),
The Code(I'm pretty sure your familiar with this):

--- Code: ---
const int led[4] = {2,3,4,5};

int pin;
int counting;

void setup()

{
for (pin =0; pin < 4; pin++ )
{
pinMode (led[pin], OUTPUT);
}
}

void loop()

{
for ( counting = 0; counting < 16; counting++)
{
LEDview();
delay (1000); // The One second delay
}
}

void LEDview()

{
digitalWrite (led[3], boolean ((counting & 8)>>3));
digitalWrite (led[2], boolean ((counting & 4)>>2));
digitalWrite (led[1], boolean ((counting & 2)>>1));
digitalWrite (led[0], boolean (counting & 1));
}
--- End code ---

Ok now i will add 7 inputs :

bit0
bit1
bit2
bit3

bits 0-3 will represent a four binary bit input

Count
CLR

if load is high digital read the values of bit0-3 and output them on output (which is the led[4] in the program)
Now if we turn load to low , maintain the value last known.
if count is high, count from the last value (example: last input 5(decimal) - 0101(binary) and then i turn count on it will continue binary counting from 5(0101))
if clear is high all output is low

Oh and this is the circuit in which I am basing the program on.

http://www.expertcore.org/viewtopic.php?style=4&f=27&t=783

Grumpy_Mike:

--- Quote ---Oh and this is the circuit in which I am basing the program on.
--- End quote ---

So it is not a real circuit but an FPGA.

--- Quote ---Now if we turn load to low , maintain the value last known.
if count is high, count from the last value (example: last input 5(decimal) - 0101(binary) and then i turn count on it will continue binary counting from 5(0101))
if clear is high all output is low
--- End quote ---

There is nothing in that code that does anything with the circuit. All it does is output your count in binary to the 4 outputs.

I am still confused as to why you need an external 4 bit counter at all. Simply output the count to LEDs attached to the pin outputs.

If you want to clock that into the counter then pulse the load line at the end of the LEDview() function.