Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


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?

Reply
 
LinkBack Thread Tools Display Modes
Old 9th October 2005, 02:14 PM   (permalink)
Default c code

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.
aibelectronics is offline  
Old 9th October 2005, 02:31 PM   (permalink)
Default

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
Megamox is offline  
Old 9th October 2005, 02:35 PM   (permalink)
Default reply

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.
aibelectronics is offline  
Old 9th October 2005, 02:48 PM   (permalink)
Default

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
Megamox is offline  
Old 10th October 2005, 07:52 AM   (permalink)
Default reply

Quote:
Originally Posted by Megamox
errrrrrrrrr i think thats all right.
Thank you very much. That is correct. :wink:
__________________
Everybody can but not everybody will.
aibelectronics is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 07:36 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

eXTReMe Tracker