Wednesday, December 23, 2009

How to make a computer program for resistor color coding?

for C/C++:





char *fndrss(char *rst)


{


if( strcmp(strlwr(rst),';blue';))


return ';0';;


else if( strcmp(strlwr(rst),';brown';))


return ';1';;


else if( strcmp(strlwr(rst),';red';))


return ';2';;


/* .


.


. Add the rest


.


*/


}





void main()


{


char resistance[50];


char first[10],second[10],third[10],fourth[10鈥?br>

cin%26gt;%26gt;first%26gt;%26gt;second%26gt;%26gt;third%26gt;%26gt;fourth;


strcpy(resistance,fndrss(first));


strcat(resistance,fndrss(second));


strcat(resistance,'; x 10^';);


strcat(resistance,fndrss(third));


strcat(resistance,'; +- ';);


strcat(resistance,fndrss(fourth));


strcat(resistance,';%';);


cout%26lt;%26lt;resistance;


}How to make a computer program for resistor color coding?
There are normally 4 to 5 coloured bands on a resistor, the following table gives the numbers.








The First and the Second ring gives the value.





The Third Ring is the multiplier.


The fourth ring is either Silver ( 10% tolerance ) or Gold ( 5% tolerance)





The fourth ring is the qulaity or the temp coefficient.








Now in order to make a computer program for this will be very simple.





Create 4 drop down boxes on the form





The drop downs will help user to select one of the colors of each band


.The third drop down should show only the silver or gold as the drop down values.





Now the computer language you use would depend on what you are familiar with or what you are interested to learn.








The following website should help you to find the actual calculation which you would need to use once the drop downs are selected by user.





http://xtronics.com/kits/rcode.htm























Black 0


Brown 1


Red 2


Orange 3


Yellow 4


Green 5


Blue 6


Violet 7


Gray 8


White 9How to make a computer program for resistor color coding?
you should be able to find a qbasic program for that on the web.





search on google.com for one

No comments:

Post a Comment