R
raullim7
i know i have posted this topic a number of times but this time its
bcos of something new that i was told to do..
i am having a counter that counts from 0 to 99, now i want to increase
the count to 0 to 199. however, i am not able to increase the
frequency, its a restriction. what i did was using dual edge behavior.
previously for 0 to 99, it only triggers during the rising edge, so
now i want to use the falling edge to take on another 100 counts. but
xilinx does not allow me to use two clock within a single process. so
now i have two process to take care of the rising and the falling
edge.
the mistake that i found is that my code is still doing 0 to 99. bcos
i cant integrate the two process together. each of them will do 0 to
99 individually. as my code is intended to run a control system that
will vary a variable as the counter runs from 0 to 199.
process1 (rising edge)
if (counter1 >= 99 )
counter1 = 0
else
counter1 = counter1 + 1;
process2 (falling edge)
if (counter2 >= 99)
counter2 = 0
else
counter2 = counter2 + 1
i tried to use a gobal variable for counter1 and counter2 so that only
1 counter is counting but is not able to compile.
for example 0 to 199, i want to check something at counter = 50, i
will not be able to get the correct result as i am only able to get
counter1= 50 or counter2=50 which is incorrect. the thing that i
wanted to check will run randomly from 0 to 199, so i am not able to
fix it and use some formulas to check it.
is there any ways to resolve my problem? kindly help and advise..
thank you very much..
bcos of something new that i was told to do..
i am having a counter that counts from 0 to 99, now i want to increase
the count to 0 to 199. however, i am not able to increase the
frequency, its a restriction. what i did was using dual edge behavior.
previously for 0 to 99, it only triggers during the rising edge, so
now i want to use the falling edge to take on another 100 counts. but
xilinx does not allow me to use two clock within a single process. so
now i have two process to take care of the rising and the falling
edge.
the mistake that i found is that my code is still doing 0 to 99. bcos
i cant integrate the two process together. each of them will do 0 to
99 individually. as my code is intended to run a control system that
will vary a variable as the counter runs from 0 to 199.
process1 (rising edge)
if (counter1 >= 99 )
counter1 = 0
else
counter1 = counter1 + 1;
process2 (falling edge)
if (counter2 >= 99)
counter2 = 0
else
counter2 = counter2 + 1
i tried to use a gobal variable for counter1 and counter2 so that only
1 counter is counting but is not able to compile.
for example 0 to 199, i want to check something at counter = 50, i
will not be able to get the correct result as i am only able to get
counter1= 50 or counter2=50 which is incorrect. the thing that i
wanted to check will run randomly from 0 to 199, so i am not able to
fix it and use some formulas to check it.
is there any ways to resolve my problem? kindly help and advise..
thank you very much..