![]() | ![]() | ![]() |
| | |||||||
| General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion? |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| http://www.electronicsforu.com/efyli...cilloscope.pdf does anyone understand how the change in time settings is accomplished in the above code? particularly the character to integer conversion part? Regarding function main, why are the 'for' loops nested? I understand the first for loop is for sampling and the second for conversion, what does nesting them achieve. How were samp value, 7000 and number 800 derived? Was it just arbitrary? thanks in advance.
__________________ Everybody can but not everybody will. | |
| |
| | (permalink) |
| If im looking at the right part, its just using the functions atoi and itoa to type cast and switch between characters and integers, and the result is assigned to the variable "times". Megamox | |
| |
| | (permalink) |
| thanks, the problem is in the values: case a represents multipliers from 2 to 9, case b represents multipliers from 10 to 99, how the character to integer conversion achieves that is what is a mystery.
__________________ Everybody can but not everybody will. | |
| |
| | (permalink) |
| Well case a is just assigning whatever the user types in, into the the first element of 'n' and it is assigned through typecast to "times". Case b is the same, except the user has typed 2 characters, and they are stored in the first and second elements of 'n' Now when the function atoi operates on the array n, it takes both elements into account and converts it accordingly. Case c is the same as case a, except the result is divided by 10. (Which is because the base time is set to 10ms, and case C is invoked when the user wants to specify a time which is 5-9, so if they put in 5 for 5ms, the variable is set with 5 X unit = 5 X 10ms, so they divide by 10. errrrrrrrrr i think thats all right. Megamox | |
| |
| | (permalink) | |
| Quote:
__________________ Everybody can but not everybody will. | ||
| |