KennyK
Joined: 18 Aug 2005 Posts: 3
|
Help with Ex_Patg |
Posted: Mon Apr 10, 2006 10:54 am |
|
|
I was wonderinf if someone could help me with the first couple of iterations of the for loop in the ex_patg.c example. I am hainvg trouble following the code.
I get that wave_period and counter are both arrays of long's, and wave_period is going to be a constant array and counter will change in the for loop.
port_b_image (from another website) makes the output into an integer. Does it do this for each output? I could not find anything on this in the manual.
For the for loop, I understand that it will increment i as long as it is less that 7 (num_outputs). I get confused once you get to the if statement. For if((++counter[i] == wave_period[i], I think that it will keep incrementing i, which relates to a number in the array, until it equals the i th number in the wave_period array. Can you give me an example of what counter array and i would look like for this loop?? (ie, i = 0, constant [1,0,0,0,0,0,0] port_image = ?, i = 1 constant = [2,0,0,0,0,0,0] port_image = ?, etc)
From what I gather from the bit_test function in the manual, it will check to see if the bit at the specified loaction (i) is a 1 or 0, and returns a true or false. If it is true, bit_clear will make that bit a 0. Else (the bit was a false, it will set it to a 1 (true))
Am I on the right track or am i completly off base.
Sorry for the noobie question. |
|