Search for ts in Topics


Microphone wiring? Answered

I have a broken microphone. Its wire is cut  inside the insulation. i want to replace the entire cable. when i removed the plastic cover of the microphone i saw a red and a black wire soldered to it.  Therefore it uses only 2 wires but in the connector it is a TRS one not a TS one. i will also replace the connector.  i am wondering how should i wire a TRS connector which has 3 leads. one being the common ground. but the other 2.  should i short them out and connect the red wire or must I connect the wire to only one lead?  Then if i buy a $0.2 TS connector and i wire it accordingly. will it work? One another question does the microphone device has polarity that is should i connect  positive to positive and negative to negative lead. because there is no indication on the Mic?

Question by ARJOON    |  last reply


Converting stereo sound to mono from an mp3 player or other similar devices? Answered

I am makin a small project where i need to input mono sound. almost all mp3 players output stereo channels.  in my circuit i have a TS connector where mono sound need to be input.  if i connect a TS connector in a TRS socket., will the output be automatically be mono or i will only get one channel out of the stereo output from the mp3 device???? thxs in advance

Question by ARJOON    |  last reply



Modify a Rockwell RK7241S Table Saw with an Incra TS-LS Table Saw Fence

First day at site and cannot find any reference to adding a TS LS Table Saw Fence to a Rockwell Jobsite Table Saw. Any wisdom, knowledge, experience would be greatly appreciated.

Topic by Lee0003    |  last reply


Motherboard preference Query (asus, msi, gigabyte) Answered

They are almost identical, and I am trying to decide which one to buy. Any help? http://www.newegg.com/Product/Productcompare.aspx?Submit=ENE&N;=-1&IsNodeId;=1&Description;=msi%20z97%20gaming%205&bop;=And&CompareItemList;=-1%7C13-132-118%5E13-132-118-TS%2C13-128-709%5E13-128-709-TS%2C13-130-770%5E13-130-770-TS&percm;=13-130-770%3A%24%24%24%24%24%24%24

Question by bobert610    |  last reply


Five nights at freddy's favorite animatronic

Who is your favorite anamatronic? Please no freaky pictures or videos :P

Topic by twilightfox    |  last reply


Convert DS18B20 temperature to string?

I want to convert DS18B20 temperature (4-bytes code from datasheet) to string with accuracy 0.1°C (like sprintf %.1f). AVR. C language (avr-gcc). I need for small code, so sprintf, floating-point types and round from math.h is bad idea. My following current code is bad also: This is the date sheet of DS18B20 void reverse_string(char *s) {     char *p, c;     for (p = s + strlen(s) - 1; s <= p; ++s, --p) {         c = *p;         *p = *s;         *s = c;     } } void ts_to_string(uint16_t ts, char *s) {     int8_t n = (int8_t)(ts >> 4);     uint8_t neg = n & 0x80;     char *p = s;     float f;     if (neg)         n = -n-1;     do {         *p++ = n % 10 + '0';     } while ((n /= 10) > 0);     if (neg)         *p++ = '-';     *p = '\0';     reverse_string(s);     *p++ = '.';     f = (float)(ts & 0xf) / 16.0;     if (neg)         f = 1.0-f;     *p++ = (char)round(f * 10.0) + '0';     *p = '\0'; }

Question by DELETED_MakiY2    |  last reply


Buy Radios, Amps and Repeaters , Icom IC-PW1 Linear amplifier, HF+6m 1kW solid-state

Contact me if you are interested in any of the rigs listed. Amps and Repeaters , Icom IC-PW1 Linear amplifier, HF+6m 1kW solid-state Kenwood TS 2000 Kenwood TS 990s Elecraft K3 Elecraft KX-3 FlexRadio 5000a FlexRadio 6300 Icom IC 7800 Icom IC 756 Pro III Icom IC 7000 Acom 2000a Icom PW-1 Email :bidbuy@aeromazonltd.com Pictures and price available on request. (73)

Topic by BECKONX    |  last reply


​Can a Pioneer GM-A3702 Two Channel Amplifier drive Pioneer TS-W306R 12-inch Subwoofer.

I want to know will the loudness of the subwoofer be loud enough. I have bought this two products but even on the highest gain setting of the amplifier, the subwoofer loudness is very small. The sound from the sub is like, driving from a LM386 op-amp. Thank you.

Question by Lima79  


Personalized Pet Products Ideas

We've just completed our first  instructable on our company for personalized pet products.  We're looking for ideas on dog breeds that we should focus on for our Limited Edition Ts. Let us know if your breed is not being represented in the marketplace.  We hope you enjoy our instructable.   https://www.instructables.com/id/My-PupPup-Jack-DanielsInstructables-Independence-/

Topic by mypuppup    |  last reply


how to make simple and cheap home sound proofing?

My home is on 2nd floor,just beside a busy road . due to ts construction materials and elevation sound pollution is more and unbearable.  as its the accommodation provided by the company i cannot modify its elevation, etc, but i can upgrade its interior. i need methods, metatarsals which helps me to reduce its noise.

Question by sudmake    |  last reply


code for servo based robot using atmega8 with turnigty tgy-S3101S servo motor.?

I'm making servo based robot using atmega8 but your code given for servo motor TS -53, but i have turnigty tgy-S3101S servo motor and don't specification of this motor like FRONT_CENTER, REAR CENTER AND SLEW SCALE values for coding. pls reply as soon as possible......

Question by vis_genius    |  last reply


How to make Noobcakes

Hey guys, i just wanted to share this quick recipe with you knexers, since your all so close to me, this is a family secret, so it does not leave this forum category, thankyou. Here we go. Ingredients: 1/2 ts salt 1/2 cup sugar 1 Shadowman39 1oz butter 3 ts chocolate powder 2 eggs So, get those ingredients, and now lets get cooking! First, crack 2 eggs into a bowl, and whisk until smooth. Next add in 1/2 ts of salt and mix with the eggs. Now take 1 Shadowman39 and slowly peel the skin and wash thoroughly. Add the Shadowman39 into the bowl with the eggs and salt, then mix a little more, carry on mixing until it has a smooth texture. After that, get you 3ts of chocolate power and add them one by one, while also adding small amount of the butter. Now all of your ingredients have been put together, mix them all up for around 2-3 minutes until thick and creamy. Next, get some cake cases and lay them evenly apart on a baking tray. Now spoon the cake mixture out of the bowl and into each cake case. Pop them in the oven at 270 degrees and bake for 20-30 minutes. When you think then are about done, take one cake and carefully poke a knife into the top, just to check if they are firm. Congrats, you have just made your own noobcakes!!! These noobcakes are great to share with your family and friends, as they are delicious. The butter combined with the eggs gives for the nice smooth texture, as the Shadowman39 gives it that wonderfully pleasant aftertaste. Thanks for taking your time to read my personal family recipe, leave your feedback below, and i wish you years of happy noobcake making. Thankyou.  

Topic by Hiyadudez    |  last reply


corrupted pdf

Howdy! (again) If this is a dupe, my apologies, I started this then closed it by accident looking for the ver of Firefox I use (37.0.2).  The problem was when I downloaded the pdf of the 'ible "How-To-Make-Pierce-Work-Jewelry", it would not open, Adobe declaring that it was corrupted.  I tried opening the pdf link in a separate window, and that didn't work either.   Trying different things, it finally worked when I downloaded it without the comments.  Not sure if it's a bug, or something illbegotten in the comments.  Anyway, thought you should know! Thanks for a Great Site! TS

Topic by dadokon6  


JEWELLERS ROLAND JWX 10 Milling Machine FOR SALE CAD CAM Technology

CNC MILLING MACHINE, JEWELLERS ROLAND JWX 10 Milling Machine FOR SALE CAD CAM Technology, BARGAIN $3000 Australian Hi, I have a used ROLAND JWX 10 for sale including all running software, reason for sale were doing a major upgrade, I`ts for sale again, I had offers and really didn`t want to get rid of this machine!  I love it!, you will too

Topic by jewellerjon    |  last reply


1,574 (large) Gin and tonics

This has been troubling me a bit: After watching Comic Strip Presents - Complete Collection [DVD] (I got it from HMV) I wondered about a segment from Mr Jolly Lives Next Door - In the film, the pair Mayall & Edmonson order 1,574 (large) Gin and tonics in a "traditional old-English illegal-drinking establishment" called The Neon Tee Pee. (Script can't be found, or un-blocked video clips any more) The thought occurred to me "How much did one large G&T; cost then?" We know that they had no money at all before receiving a brown envelope stuffed with bank notes. The brown envelope should have contained £3000 and I'll assume that it did. In being exact about the quantity of G&Ts;, I conclude that they knew exactly how much money they had, and how much the drink cost. If follows that all the £3000 was counted, why leave any in the van if you're going for that much alcohol? Later the £3000 is acknowledged, but 2 pound notes remain. At a maximum of £2998, 1574 G&Ts; work out at £1.90 each which sounds reasonable for 1983. But that leaves £7.40, and the £2 of course. What did they do with the £7.40, what was the £2 for, why did they not ask for 1578? Cigarettes? And if so, how many? Or is there some special significance to 1574? L

Topic by lemonie    |  last reply


Can this unit “Pioneer mvh-s219bt” drive two of this “Pioneer TS-R6951S 3 Way Coaxial Speakers” without any external amplifiers?

I am trying to replace my factory head unit and two speakers system in my car, with the above system, i am poor so if this works then please dont suggest any other options or better company names, just tell me whether my new system works fine or do i need an amp to just power those two speakers? i am not planing to have woofers tweeters or any other speakers, only these two coaxial speakers on two front doors, will this work? thank you for the help :)

Topic by sreessxp    |  last reply


Guitar Hero World Tour Drum kit...wiring to the yellow cymbol connector jack, can it be fixed?

I think the connector jack which plugs into the yellow cymbol is a right angle TS jack. But how does one rewire it? I need to attach a new connector but the liklihood of successfully soldering the layers of tiny filaments that form the wire seems remote. Is it possible to buy a connector already attached to a length of wire so that I can try and attach it at the other end? Does anyone know where the wire goes when it disappears inside the cymbol support? Would really appreciate some help especially after discovering that the guarantee only lasts 90 days! Thanks

Question by wantie002  


wiring my subwoofers to amplifier?

4 Ω x 2ok i have a  JBL amplifier    and a pair of pioneer dual coil subwoofer with impedence 4 Ω x 2  ( http://www.pioneerelectronics.com/PUSA/Car/Subwoofers/Champion+Series+PRO/TS-W3002D2|D4 ) i'm not sure if it will work just fine if i connect the 2 subs to the amp at 2ohms each, because i wired it to make a 8ohm impedence on each sub and works just fini!!! but  i'm not satisfied with the output power will it work fine if i connect both subs at 2ohms impedance(set the coils in parallel on each sub) on each sub to the amplifier???? don't worry about the power delivery, i have a 2X10farad capacitors, and a 55AH battery installed in the car

Question by ARJOON  


More hiss from external powered wah?

I put together a gig box with power, and everything is fine.only problem is I have a George Dennis wah at the beginning of the chain, with a battery it is just fine. It has a power jack mini plug ts connector. Tip is positive and ring is ground. I am a technician , so I made a cord from the gig box power supply, reversed the tip and ring, because the ring is positive with guitar toys, it works but now I have a lot of hiss, more than normal, I use a nova drive of distortion and have a noise gate. When I unplug the power from the wah the hiss normalizes. if I use an external power supply for the wah it is ok. Used a meter and the power is correct 9.3 volts dc. Not sure what to make of this?

Question by JosephR154    |  last reply


Bad result from the CFL driver for the flyback transformer.

Ts been a while that i have tryed to make a nice arc from my 25 watt cfl driver, the only pin on the cfl that are working are the pin 1 and 4, i i have attempted to connect the pin 1 and 2 toguether and 3 and 4 toguether, i connected both of the mix on the flyback and i could get a huge arc, but i plugged it like 5 sec, and i stopped touching the HV output with the 0v ground  for like 2 sec then my cfl has exploded like a bomb, there was lound noise, and made a hole in my table. so im not gonna try that again. Anyway i can only get 0.5 cm arc from the flyback, and i dont know what to do to make it larger, i know that the 25w cfl can do better. Any suggestion? Sorry for my bad english.

Topic by insistent    |  last reply


tv tuner and videolan

I try to setup a computer to record tv broadcasts (from tv tuner card) to file. the computer runs videolan and windows xp sp2if i open videoln and go to file - open device or run this from the runc:\vlc\vlc.exe dshow:// :dshow-vdev="Conexant BtPCI Capture" :dshow-adev="RealtekAC97 Audio" :dshow-size="640X480"it shows the video and sound ok (without record)if i run thisc:\vlc\vlc.exe dshow:// :dshow-vdev="Conexant BtPCI Capture" :dshow-adev="RealtekAC97 Audio" :dshow-size="640X480" --sout file/avi:temp.aviif its something short (up to 1 min) the saved file is ok in the beginning and then sound is distortedif its longer videolan crashes and saves nothingif i run something likec:\vlc\vlc.exe dshow:// :dshow-vdev="Conexant BtPCI Capture" :dshow-adev="RealtekAC97 Audio" :dshow-size="640X480" --sout "#transcode{vcodec=mp1v,vb=800,scale=1,acodec=mp3,ab=256,channels=2}:duplicate{dst=std{access=file,mux=ts,dst=temp.mpg}}"it shows the video and sound (as in the 1st example) but does not make any filehow can i save with vlc in good quality (suitable for movies) and good quality (bu not one that fills up the hard drive for one movie) codec like mpeg4 etc ?

Topic by 11010010110    |  last reply


any idea's on magnetic generators that would generate 34.5 watts output (3.5 volts, 7 amps) need to cut power costs.

Aluminum Base 1” long x ½” Diameter Oil Impregnated Brass Sleeve Bearing 4” long x ½” Diameter Brass Shaft 1 ¾” long x 2” Diameter Brass Rotor 0.10” thick Mica Insulation 0.005” thick Mylar Insulation 0.04” thick Copper Coated Steel Wire (228 U-shaped pieces) .032” thick Copper Coated Steel Wire (12 coils of 11 turns) 0.014” thick Insulated Copper Wire 12 Permanent Magnets ¾” long, 5/8” wide, 3/8” thick o Fe, Isotropic permanent magnet material cooled in a magnetic field, Cast 9100 TS. 450 Brin, 2.2 Peak energy product. ** **magnet specifications: Alnico 4, M-60; 12 AL, 28 Ni, 5 Co, bal Crimped Cooper clips 0.30 thick Copper Tube 2” long x 2 ½” diameters. Acrylic Ring-Dimensions 3 ¾” O.D., 2 ¼” I.D., 3/8” 0.002” thick Plastic Insulation Paper Acrylic holding shapes Acrylic dome Liquid Acrylic                                                 rough parts list Parts List (there is a list of parts suppliers in the next section):

Question by wisteria92    |  last reply


Data updating on thingspeak (cloude) only once

 I am trying to update Thingspeak using Edison. It updates thingspeak but only at once. If I have to update again I have to run the code again. #include #include // ThingSpeak Settings char thingSpeakAddress[] = "api.thingspeak.com";  //TS String writeAPIKey = "**************";    //TS const int updateThingSpeakInterval = 20 * 1000;      // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval) char ssid[] = "*********";     //  your network SSID (name) char pass[] = "*********";  // your network password int status = WL_IDLE_STATUS;     // the Wifi radio's status // initialize the library instance: WiFiClient client; String stringVal = ""; // Variable Setup long lastConnectionTime = 0; boolean lastConnected = false; int failedCounter = 0; int a; float tempC; int B=3975; float resistance; void setup() {   //Initialize serial and wait for port to open:   Serial.begin(115200);    while (!Serial) {     } //  check for the presence of the shield: // if (WiFi.status() == WL_NO_SHIELD) {   //   Serial.println("WiFi shield not present");     // don't continue:     //while(true); //} // attempt to connect to Wifi network:   while ( status != WL_CONNECTED) {     Serial.print("Attempting to connect to WPA SSID: ");     Serial.println(ssid);     // Connect to WPA/WPA2 network:       status = WiFi.begin(ssid, pass);     // wait 10 seconds for connection:     delay(10000);      }     // you're connected now, so print out the data:   Serial.println("You're connected to the network");   // printCurrentNet();   // printWifiData(); }   void loop() { a = analogRead(0); resistance=(float)(1023-a)*10000/a; tempC=1/(log(resistance/10000)/B+1/298.15)-273.15; // converts temp  to string      stringVal += String(int(tempC))+ "."+String(getDecimal(tempC)); //char buf[16]; //String strTemp = floatToString(16 , cel , 5); //Serial.println(strTemp); // Print Update Response to Serial Monitor   while (client.available())   {     char c = client.read();     Serial.print(c);   }   // Disconnect from ThingSpeak   if (!client.connected() && lastConnected )   {     Serial.println("...disconnected");     Serial.println();        client.stop();     }   // Update ThingSpeak   if(client.connected() && (millis() - lastConnectionTime > updateThingSpeakInterval))   {     updateThingSpeak("field1="+stringVal);      Serial.print( stringVal);          Serial.println("C");      delay(1000);      Serial.println();         }   lastConnected = client.connected(); } //function to extract decimal part of float long getDecimal(float val) { int intPart = int(val); long decPart = 100*(val-intPart); //I am multiplying by 100 assuming that the foat values will have a maximum of 3 decimal places                                    //Change to match the number of decimal places you need if(decPart>0)return(decPart);           //return the decimal part of float number if it is available else if(decPart<0)return((-1)*decPart); //if negative, multiply by -1 else if(decPart=0)return(00);           //return 0 if decimal part of float number is not available } void updateThingSpeak(String  stringVal) {   if (client.connect(thingSpeakAddress, 80))   {            client.print("POST /update HTTP/1.1\n");     client.print("Host: api.thingspeak.com\n");     client.print("Connection: close\n");     client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");     client.print("Content-Type: application/x-www-form-urlencoded\n");     client.print("Content-Length: ");     client.print( stringVal.length());     client.print("\n\n");     client.print( stringVal);        lastConnectionTime = millis();        if (client.connected())     {       Serial.println("Connecting to ThingSpeak...");       Serial.println();            failedCounter = 0;     }     else     {       failedCounter++;       Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");        Serial.println();     }      }   else   {     failedCounter++;        Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");      Serial.println();        lastConnectionTime = millis();   } } after running this code I get this(image attached)

Question by ANINDYAB5    |  last reply


box(es) for sub(s)?? How many? What size? Here's some measurements.

So... Got some subs I had lying around: http://www.crutchfield.com/p_500SWE1042/Alpine-SWE-1042.html?tp=111&tab;=features_and_specs I am trying to figure out if I should vent (I don't think I should from research) and if I can do them in a single box or if it's better to put them each in a box. I also haven't found out if I should JUST double the volume for having both in one box or if it should be a different amount. The suggested volume I've calculated is 4.1 cu ft (but that seems a bit huge).       V(as) 33 liters   |    Q(ts) 0.66    |    10 Inch The speakers will be in series, I don't know if this affects whether or not I can put them in a single box. How much does the shape of the box matter? Can I make a rectangular cube and put the speakers at either end or do they need to be on the same side? When it comes to fill would it be better to use something fluffy that takes up a large amount of space like very fluffed out cotton or is carpet always the better way to go? I cannot find how much fill I SHOULD use. I have found suggestions for just carpet on the back wall and some for all sides wherever you can and even two people suggested to fill it to about 80% (though it did not say what with). Any questions?

Topic by Andale_The_Great    |  last reply


Technology Makes Cheap Drinking Water from Air

INTRODUCTION:   How can we best apply basic technology to help the underprivileged and/or disaster-hit countries like Haiti? Daily hygiene and nourishment are among the top needs for disaster ridden regions!  Simply put, no water means no hygiene. The Romans understood that over two millennia ago and created their complexly beautiful aqueduct networks for handling both fresh and wastewater! Other ingenious water systems like “air wells” have been found in the city of Theodosia (cf: discovered in 1900 by Zibold, see Zibold’s Collectors/Dehumidifiers) dating back to Greco-Roman times during the Byzantine Empire. These were strictly passive systems that naturally dehumidified air, collecting its potable water in underground basins. All air, even in relatively dry desert regions, will precipitate or release its natural water content (initially in the form of vapor) through condensation when it hits its dew-point temperature and below. That means you “chill” it to an appropriate level that is anywhere from 5F to 50F below its current air temperature, depending upon how much water content (relative humidity) it has locally absorbed. The condensation of the water vapor releases its internal latent heat (reheating the cooled air) which must be constantly dissipated (absorbed by something) in order for water formation to steadily continue. So how do we dissipate this resultant vapor-heat and chill our air without any infrastructure or electricity, in an underprivileged or disaster-ridden region? We simply bury a long cast-iron or any metallic drain-pipe sufficiently underground where the temperature of the earth is naturally held to a constant at around 45F to 55F. That’s our “free” chiller gift from nature. One end of the pipe, Figure-1,  sticks out of the ground to suck-in local outside hot air, and the other end dumps cooled dry air and water into an underground cistern where it gets collected and is piped to the surface to both exhaust the cooled dry air and connect to a water pump. We need a hand operated water pump to lift up the water above ground, and we need an electric fan to constantly pump air through the ground-chilled piping system. We can even force the cooled piped air to exhaust into a tent-like structure where it provides air conditioning as an added bonus, but this adds the penalty of both power and the increased fan size necessary to drive our required airflow further into an enclosure! While this concept is not “passive” (requiring electricity to work) like those clever Byzantine air-wells, it will produce much more potable water and within a smaller volume than those elegantly passive historic devices. The electricity for our fan power requirements can be produced by any one of four ways using either “active” or “passive” techniques: 1) An active playground or bike-pedaling-person or oxen-driven mechanism-generator, 2) A passive windmill generator, 3) A passive solar energy collection system that directly generates electricity, or 4) A passive thermo-electric system that directly generates electricity using the Peltier effect, operating solely on temperature differences between the cell’s top and bottom surface (we jury-rig the cool pipe and hot ambient air to contact separate sides of the cell). Depending upon how much water is needed, the required air volume plus pipe length and diameter, together with the fan will be sized accordingly. We can also configure groups of parallel fan-driven air pipes that are radially fed into the cistern. The sizing of this underground network depends upon the ambient air’s local average temperature and relative humidity (how much water gets absorbed into the air) plus buried pipe depth and effective underground temperatures achieved. The basic concept is one where we “wring” water from air at some given humidity content. The higher its relative humidity the more water is recovered from the air. The air-wringing process simply chills the air as it scrubs along the cooled internal pipe surface until it starts to rain inside the pipe from condensation onto its surface. The condensation is like the dew that forms on car windows, grass or any cooled surface in the early morning, before the sun comes out and evaporates the dew back into the heating air. A further bonus is that our dew-formed water is naturally distilled and very clean. It is potable water ready to drink without the need for additional sterilizing agents. Of course, we must make sure that the interior piping and cistern network is biologically cleansed before burying it underground. The hand pump with its 10 to 15 foot extended piping to reach the underground cistern must also be cleansed. The beauty of this constantly replenishable water supply is its convenient underground installation anywhere! After the in-ground installation, we have a virtual, partially passive, no moving parts, non-breakdown system containing above ground total access to all moving parts that could breakdown, namely the water pump and electric fan. Also, it is easily maintained, with few moving parts (water hand-pump and electric fan) and basically lacking any technical complexity which makes it ideal for technologically backward regions. The example below uses a relatively small industrial fan moving air at 1500 CFM (Cubic Feet per Minute) with a DC motor rated at 1kW. This fan together with our underground piping system will conservatively generate 12 GPH (Gallons Per Hour) of potable drinking water without need for any purification chemistry. Based on an average electrical cost of 14-cents per kWh (kilo-Watt hour), the typical commercial distillation of one gallon of drinking water costs roughly 35-cents as compared to our cost of only 1.2-cents. Furthermore, if we decide to go green and use solar energy for generating our water, it would effectively cost us nothing beyond the initial installation! USING A PSYCHROMETRIC CHART TO SIZE OUR WATER SUPPLY: The following gets a little technical and is only provided for those die-hards who are truly interested in how the science works. Those non-technically schooled may skip this part and not miss the basic concept. Figure-2 shows a Psychrometric Chart for air. This chart summarizes some of the basic thermodynamic properties of air throughout its typical range of operating temperature. The chart uses six basic air properties that defines the physical chemistry of water evaporation into air:  (1) the enthalpy or total energy contained within a unit of air which is a combination of its internal and external energy, expressed as the amount of BTU-energy per unit mass of reference dry-air, (2) the specific volume or the ratio of a unit volume of local air to its mass of reference dry-air, (3) the humidity ratio or the amount (mass) of moisture in a local unit of air divided by its reference mass of dry-air, (4) the percent relative humidity per unit of local air, or the mass ratio (expressed in percentage form) of the partial pressure of water vapor in the air-water mixture to the saturated vapor pressure of water at those conditions (the relative humidity depends not only on air temperature but also on the pressure of the system of interest),  (5) the dry-bulb temperature or the locally measured air temperature, and (6) the wet-bulb temperature or saturation temperature which is the local air temperature experienced during constant water evaporation (a wet-bulb thermometer is typically used:   a thermometer that measures resultant temperature while wrapped in a water wet-gauze and spun to generate local air movement and max-evaporation)  1.0   The Process and A Sample Calculation Our Psychrometric Chart uses six thermodynamic properties that help to determine the amount of water available for extraction from the local ambient air as a function of its temperature, pressure and relative humidity.  Let’s assume the following local ambient conditions for the region we plan to construct our water system at:  (1) Typical daily air temperature Td = 106F and one atmosphere pressure assumed at sea-level, (2) Relative Humidity, RH = 55%, and (3) Typical underground temperature down at six feet is measured at Tu=55F (at 12ft. it drops to ~45F). This yields the following calculated results for obtaining a steady-state supply (changes at night) of water to fill the cistern:      1)      In our example, the “local” air (dry-bulb) temperature is Td=106F, at a relative humidity of RH= 55%.  Fig-2 indicates that the resultant Humidity Ratio is HR= 0.0253 Lbs-water/Lb-Dry-Air (intersection of Td=106F line and RH=55% line, then horizontal to HR value).  We then determine the “gulp” of air volume containing the HR Lbs-water which corresponds to the point of intersection of Td and RH. Interpolating on specific volume “mv” yields mv=14.7 ft3/Lb-Dry-Air (this value sets the optimum unit airflow for our given ambient conditions, and creates a ballpark pipe length to diameter ratio needed later). It represents the basic unit of air volume that will enter our underground pipe per given time, and ultimately defines the size of our fan and piping network. For increased water creation, multiples of this unit volume will scale up the additional amounts of water that can be collected. 2)      As the inlet air cools down to a temperature of Tu=55F, from contact with the relatively cold underground pipe, we follow the constant enthalpy line (red upward left-diagonal) from the intersection of Td and RH to its saturated air temperature condition of Ts= ~88F, which is its dew-point temperature where the corresponding local RH=100%.  At this temperature or under, the air precipitates and releases its moisture content, resulting in water condensation onto the pipe walls.  Since our air will chill to a final pipe temperature of Tu=~55F, we follow the RH=100% saturated curve (green) down to yield an HR=~0.009 Lbs-water/Lb-Dry-Air. This is how much water is left in the air when it gets to 55F.  Therefore for every pound of local outside air that enters the pipe, mw=0.0253 – 0.009 = 0.0163 pounds of absolute pure, distilled potable water precipitates onto the inside pipe wall (per pound of dry air that is cooled and dehydrated) to gravity-flow out the pipe exit and into the cistern. 3)      We now convert pounds of air per unit time into a unitized volumetric airflow that yields gallons of hygienically pure potable water production per unit time. For every Va=100 ft3 of local volumetric air movement per minute (CFM) through the pipe, which translates into ma=Va/mv= 100/14.7 = 6.8 lbs. of dry air per minute or 6.8 * 60 = 408 lbs. per hour (PPH), to yield a water-flow of mwf=ma * mw = 408 * 0.0163 = 6.65 PPH or 6.65/8.345 = 0.8 GPH of water.  An industrial fan rated at 1kW DC will typically move 1500 CFM at a pressure of 8-iwc, to continuously produce 15 * 0.8 = 12 GPH of pristine potable water. 4)      Not shown here are the design details of sizing our pipe, fan and solar collection system for electric power requirements using heat transfer principles coupled with a thermodynamic heat balance, and aerodynamic fan performance assessment. These details help to size the electric power generation requirements plus margin used to properly size a solar collector containing further margins for overcast days. The engineering involved here is straight forward but beyond the scope of the current project.

Topic by RT-101    |  last reply


Change a 7 seg display from CC to CA in code? Answered

I am not as familiar with C/C++ as i am with Arduino. I am wanting to change this code from Common Cathode to Common Anode. How can i do this? //_____________________ fuse.c #define F_CPU 8000000UL #include #include #include #include #include #define _REVERSE #define _OPT_BUTTON_ /* . document tab-stop set to 4, best viewed w/ vi set to ":set ts=4" . description   this project is created so that if i could revert the RESET fuse change and flash via   SPI again. . features   . reads device signature and hi-low fuses for hi-voltage serial programmable attinys   . reset hi-low fuses to factory default on target devices   . layout to drop-on attiny13, attiny25/45/85 8 pin devices targets   . attiny24/44/84 targets needs additional breadboard and jumper wires   . standalone operations, fuses show on 7 segment display . project fuse setting   avrdude -c usbtiny -p t2313 -V -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m . parts list   . attiny2313   . 4x7 segment LED display   . 1k resistor x 2   . 2n2222 NPN transistor or equivalent   . 78L05   . mini breadboard 170 tiepoints   . +12V battery source . opearation   . place 8 pin target device on breadboard   . for 14 pin targets, jumper wire to breadboard   . apply 12V power   . display shows device name upon identification   . press and release button to cycle display content   . displays device name, fuse hi bits, fuse low bits and fuse extended bits   . long press and release button to reset fuse to factory default   . references and related projects   . datasheets   . avrdoper http://www.obdev.at/avrusb/avrdoper.html/   . mightyohm http://www.mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/                  Gd 12V                  Gd Rt V+ Ck MI MO (tinyusb programmer)                   +  +  +  +  +  +    +=====================================================+    |  .  .  .  .  .  I  .  .  .  .  .  .  .  .  .  .  .  | [I]n (78L05)    |  .  .  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  | [C]ommon    |  .  .  .  .  .  .  O  .  .  .  .  .  .  .  .  .  .  | [O]ut    | (v)(d)(b)(c) +--------o (v) .  .  .  .  . (d)(c) .  |    |  +--+--+--+  |  o  +--+-(1)-A--F-(2)(3)-B--+--+  .  |    | |+         | 1k | |+ b7..6..5..4..3..2..1..0 d6|    |    | |         -| |  1k|R d0..1 a1..0 d2..3..4..5  -|    |    |  +--+--+--+  o  |  +--+--+--+--+--+--+--+--+--+  .  |    |  .  .  .  .  .  o  -  -  E  D (.) C  G (4) -  -  .  |    |  o--------------o  .  .  .  .  .  .  .  .  .  .  .  |    |  . (a) .  E  B  C  . (a) .  .  .  .  .  . (b) .  .  | EBC of 2n2222    |  .  .  .  .  .  .  .  .  .  .  .  .  .  o--B--o  .  |    +=====================================================+                     (p)(p)                                 join (p)(p) during programming       SDO   SDI     +--+--+--+    |+    SII  |    |R        -|     +--+--+--+       SCI #define HIV _BV(7) //b7 .. RESET #define VCC _BV(6) //b6 .. (v) #define SDO _BV(0) //b0 .. (d) #define SCI _BV(0) //d0 .. (a) #define SII _BV(5) //d5 .. (b) #define SDI _BV(6) //d6 .. (c) */ #define BUTTON_DDR   DDRD #define BUTTON_PORT  PORTD #define BUTTON_PIN   _BV(4) #define SEG_A_PB _BV(5) #define SEG_B_PB _BV(1) #define SEG_C_PB 0x00 #define SEG_D_PB 0x00 #define SEG_E_PB 0x00 #define SEG_F_PB _BV(4) #define SEG_G_PB 0x00 #define SEG_d_PB 0x00 #define DIGIT_0_PB _BV(6) #define DIGIT_1_PB _BV(3) #define DIGIT_2_PB _BV(2) #define DIGIT_3_PB 0x00 #define SEG_A_PD 0x00 #define SEG_B_PD 0x00 #define SEG_C_PD _BV(2) #define SEG_D_PD _BV(7)  // d.7 maps to a.1 #define SEG_E_PD _BV(1) #define SEG_F_PD 0x00 #define SEG_G_PD _BV(3) //#define SEG_d_PD 0x00 #define SEG_d_PD _BV(6)  // d.6 maps to a.0 #define DIGIT_0_PD 0x00 #define DIGIT_1_PD 0x00 #define DIGIT_2_PD 0x00 #define DIGIT_3_PD _BV(4) #ifdef _REVERSE #define HOLD_DDR_VAL 0x60 #define HOLD_VAL   0x40 #else #define HOLD_DDR_VAL 0x18 #define HOLD_VAL   0x08 #endif #define SEGS_STAY(v) \    (((v & _BV(6)) ? 1 : 0) +\ ((v & _BV(5)) ? 1 : 0) +\ ((v & _BV(4)) ? 1 : 0) +\ ((v & _BV(3)) ? 1 : 0) +\ ((v & _BV(2)) ? 1 : 0) +\ ((v & _BV(1)) ? 1 : 0) +\ ((v & _BV(0)) ? 1 : 0)) | 0x40 #define SEGS_PORT_DET(p, v) \    (((v & _BV(6)) ? SEG_A_P##p : 0) | \ ((v & _BV(5)) ? SEG_B_P##p : 0) | \ ((v & _BV(4)) ? SEG_C_P##p : 0) | \ ((v & _BV(3)) ? SEG_D_P##p : 0) | \ ((v & _BV(2)) ? SEG_E_P##p : 0) | \ ((v & _BV(1)) ? SEG_F_P##p : 0) | \ ((v & _BV(0)) ? SEG_G_P##p : 0)) #define SEGS_PORT(v) {SEGS_STAY(v),SEGS_PORT_DET(B, v),SEGS_PORT_DET(D, v)} #define SEGS_B (SEG_A_PB|SEG_B_PB|SEG_C_PB|SEG_D_PB|SEG_E_PB|SEG_F_PB|SEG_G_PB|SEG_d_PB) #define SEGS_D (SEG_A_PD|SEG_B_PD|SEG_C_PD|SEG_D_PD|SEG_E_PD|SEG_F_PD|SEG_G_PD|SEG_d_PD) #define DIGITS_B (DIGIT_0_PB|DIGIT_1_PB|DIGIT_2_PB|DIGIT_3_PB) #define DIGITS_D (DIGIT_0_PD|DIGIT_1_PD|DIGIT_2_PD|DIGIT_3_PD) #define USED_B (SEGS_B|DIGITS_B) #define USED_D (SEGS_D|DIGITS_D) /*        ___a__       |      |      f|      | b        ___g__      e|      | c       |      |        ___d__ */ //_____________________ abc defg #define LTR_0 0x7e // 0111 1110 #define LTR_1 0x30 // 0011 0000 #define LTR_2 0x6d // 0110 1101 #define LTR_3 0x79 // 0111 1001 #define LTR_4 0x33 // 0011 0011 #define LTR_5 0x5b // 0101 1011 #define LTR_6 0x5f // 0101 1111 #define LTR_7 0x70 // 0111 0000 #define LTR_8 0x7f // 0111 1111 #define LTR_9 0x7b // 0111 1011 #define LTR_A 0x77 // 0111 0111 #define LTR_b 0x1f // 0001 1111 #define LTR_C 0x4e // 0100 1110 #define LTR_d 0x3d // 0011 1101 #define LTR_E 0x4f // 0100 1111 #define LTR_F 0x47 // 0100 0111 #define LTR_P 0x67 // 0110 0111 #define LTR_G 0x5e // 0101 1110 #define LTR_n 0x15 // 0001 0101 #define LTR_r 0x05 // 0000 0101 #define LTR_t 0x0f // 0000 1111 #define LTR__ 0x00 // 0000 0000 uint8_t EEMEM digit2ports[][3] = { SEGS_PORT(LTR_0), SEGS_PORT(LTR_1), SEGS_PORT(LTR_2), SEGS_PORT(LTR_3), SEGS_PORT(LTR_4), SEGS_PORT(LTR_5), SEGS_PORT(LTR_6), SEGS_PORT(LTR_7), SEGS_PORT(LTR_8), SEGS_PORT(LTR_9), SEGS_PORT(LTR_A), SEGS_PORT(LTR_b), SEGS_PORT(LTR_C), SEGS_PORT(LTR_d), SEGS_PORT(LTR_E), SEGS_PORT(LTR_F), SEGS_PORT(LTR_r), SEGS_PORT(LTR_P), SEGS_PORT(LTR_G), SEGS_PORT(LTR_n), SEGS_PORT(LTR_t), SEGS_PORT(LTR__), }; enum { POS_0, POS_1, POS_2, POS_3, POS_4, POS_5, POS_6, POS_7, POS_8, POS_9, POS_A, POS_b, POS_C, POS_d, POS_E, POS_F, POS_r, POS_P, POS_G, POS_n, POS_t, POS__, }; #define ST_HOLD  0x80 #define ST_PRESSED 0x40 #define ST_BUTTON   (ST_HOLD|ST_PRESSED) #define ST_TICKED 0x20 #define ST_12HR  0x10 #define ST_REFRESH 0x08 #define ST_BUZZ     0x04 #define ST_SETUP    0x03 #define ST_SENSE ST_BUZZ volatile uint8_t busy=0; volatile uint8_t state=ST_REFRESH|ST_12HR; volatile uint8_t dim=1; uint8_t  pos=0, stays; uint8_t  mode=0; #ifdef _OPT_SENSE_ uint16_t charged=0; #endif uint16_t button=0; uint16_t clicks=0, ticks=0; //_______________________ ticks per second and devired values #define TPS   (F_CPU/256) #define TPS_2 (TPS/2) #define TPS_4 (TPS/4) #define LONG_HOLD (TPS/3) #define NUM_DIGITS 4 static const uint8_t digit_mapb[] PROGMEM = { 0x40,0x08,0x04,0x00 }; static const uint8_t digit_mapd[] PROGMEM = { 0x00,0x00,0x00,0x10 }; //_________________ list of porta..c,ddra..c,stay * number_of_digits uint8_t output[3 * NUM_DIGITS]; uint8_t *ioptr = output; uint8_t dot = 0x00; //__________________________________________________ ISR(TIMER0_OVF_vect) { clicks++; if (clicks >= TPS) {   clicks = 0;   state |= ST_TICKED;   ticks++; }//if if (stays & 0x0f) { stays--; return; } stays >>= dim; DDRA  &= ~(USED_D>>6); DDRB  &= ~USED_B; DDRD  &= ~(USED_D&0x3f); PORTA &= ~(USED_D>>6); PORTB &= ~USED_B; PORTD &= ~(USED_D&0x3f); if (stays) { stays--; return; } if (busy) return; #ifdef _OPT_BUTTON_ //___________ scan button PORTD |= BUTTON_PIN; _delay_us(1);  // allow pull-up to settle if (PIND & BUTTON_PIN) {   if (button) {    if (button > 30) {     //_________ released     if (button > LONG_HOLD)      state |= ST_HOLD;     else      state |= ST_PRESSED;     stays = 0x14;    }//if   }//if   else {    stays = 0x10;   }//else   button = 0; }//if else {   //_____________ pressed   button++;   if (button > LONG_HOLD) { // show long hold #ifdef _REVERSE    DDRB |= HOLD_DDR_VAL; PORTB |= HOLD_VAL; #else    DDRD |= HOLD_DDR_VAL; PORTD |= HOLD_VAL; #endif   }//if }//else PORTD &= ~BUTTON_PIN; DDRD  &= ~(USED_D&0x3f); PORTD &= ~(USED_D&0x3f); if (state & ST_BUTTON) return; if (button) return; #endif #ifdef _OPT_SENSE_ if (!charged && (state & ST_SENSE)) {   state &= ~ST_SENSE;   DDRB  = 0x00; PORTB = 0x00;   DDRD  = 0x00; PORTD = 0x00;   _delay_us(1);   //_________ charge sensor led   charged = 1;   //SENSE_CHARGE   DDRA  |=  SEGS_D>>6;   PORTA &= ~(SEGS_D>>6);   DDRB  |=  SEGS_B;   PORTB &= ~SEGS_B;   DDRD  |=  SEGS_D&0x3f;   PORTD &= ~(SEGS_D&0X3f);   DDRB  &= ~0x44;   PORTB |=  0x44;   //DDRB  &= ~_BV(6);   //PORTB |= _BV(6);   //_delay_us(1);   //asm volatile("nop\n\tnop\n\tnop\n\tnop\n\t"::);   //asm volatile("nop\n\tnop\n\tnop\n\tnop\n\t"::);   //asm volatile("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"::);   //while (!SENSE_BUTT);   //PORTB &= ~_BV(6);   while (!SENSE_ALL);   PORTB &= ~0x44;   return; }//if #endif //___________ load segments uint8_t portd = *ioptr++; uint8_t portb = *ioptr++; uint8_t porta = portd >> 6; portd &= 0x3f; //uint8_t mapb = digit_mapb[pos]; //uint8_t mapd = digit_mapd[pos]; uint8_t mapb = pgm_read_byte(&digit;_mapb[pos]); uint8_t mapd = pgm_read_byte(&digit;_mapd[pos]); DDRA  |= porta; DDRB  |= portb | mapb; DDRD  |= portd | mapd; #ifdef _REVERSE PORTA |= ~porta; PORTB |= ~portb & mapb; PORTD |= ~portd & mapd; #else PORTA |= porta; PORTB |= portb & ~mapb; PORTD |= portd & ~mapd; #endif stays  = *ioptr++; if (stays && (state & ST_SETUP) && (clicks / TPS_2) &&   ((pos == (state & ST_SETUP)) ||   (!pos && !(state & 0x02))))   stays = 0x08; pos++; if (pos >= 4) {   pos = 0;   ioptr = output; }//if } //__________________________________________________ void seg2port(uint8_t bcd, uint8_t which) { if (which & 0x40) {   //_____________ bcd entry, do 2nd digit 1st, then 1st digit   which &= 0x0f;   seg2port(bcd&0x0f, which+1);   bcd >>= 4; }//if uint8_t *pp = output + which * 3; uint8_t offset = 3; busy++; do {   *pp++ = eeprom_read_byte(&digit2ports;[bcd][--offset]); } while (offset); busy--; } #define HIV _BV(7) //b7 #define VCC _BV(6) //b6 #define SDO _BV(0) //b0 #define SCI _BV(0) //d0 #define SII _BV(5) //d5 #define SDI _BV(6) //d6 #define SCI_PULSE _delay_us(1); PORTD |= SCI; _delay_us(1); PORTD &= ~SCI; //__________________________________________________ uint8_t hv_cmd(uint8_t *dptr, uint8_t cnt) { // data format is like write 0_DDDD_DDDD_00 //                      read D_DDDD_DDDx_xx uint8_t sdo=0x00; while (cnt) {   uint8_t sdi = *dptr++;   uint8_t sii = *dptr++;   uint8_t cmp=0x80;   sdo = 0x00;   PORTD &= ~(SDI|SII);   SCI_PULSE;   //sdo = ((PINB&SDO;) ? 1 : 0);   //sdo = ((PINB&SDO;) ? 0 : 1);   // 0x1e92 06   // 0x62df b0110 0010 1101 1111   while (cmp) {    sdo <<= 1;    //sdo |= ((PINB&SDO;) ? 0 : 1);    //sdo |= ((PINB&SDO;) ? 1 : 0);    if (PINB&SDO;) sdo |= 0x01;    PORTD &= ~(SDI|SII);    if (cmp&sdi;) PORTD |= SDI;    //else         PORTD &= ~SDI;    if (cmp&sii;) PORTD |= SII;    //else         PORTD &= ~SII;    SCI_PULSE;    //sdo |= (PINB&SDO;) ? 1 : 0;    cmp >>= 1;   }//while   PORTD &= ~(SDI|SII);   SCI_PULSE;   SCI_PULSE;   _delay_us(100);   cnt--; }//while //sdo = cnt; return sdo; } uint8_t chip_sig[] = { 0xee, 0xee, 0xee, 0xee, 0x00, 0x00 }; //__________________________________________________ void read_chip(uint8_t release_reset) { cli(); busy++; // enter hv mode, everything go low DDRB  |= (VCC|HIV|SDO); PORTB &= ~(VCC|SDO);// Vcc and data out off PORTB |= HIV;  // 12v off DDRD  |= (SCI|SDI|SII); PORTD &= ~(SCI|SDI|SII); //_delay_ms(50); PORTB |= VCC;  // Vcc on _delay_us(40); PORTB &= ~HIV;  // turn on 12v _delay_us(15); DDRB  &= ~SDO;  // release SDO _delay_us(300); // should be ready to issue commands // read signature // // default fuse settting taken from http://www.engbedded.com/fusecalc/ // // mcu - id          - factory fuse low-high-extended // t13 - 1e9007 (07) - 6a-ff // t25 - 1e9108 (18) - 62-df-ff // t45 - 1e9206 (26) - 62-df-ff // t85 - 1e930b (3b) - 62-df-ff // t24 - 1e910b (1b) - 62-df-ff // t44 - 1e9207 (27) - 6a-df-ff // t84 - 1e930c (3c) - 6a-df-ff // signature  { 0x08, 0x4c, 0xpp, 0x0c,      0x00, 0x68,      0x00, 0x6c // write fuse { 0x40, 0x4c, val,  0x2c,      0x00, 0x64/0x74, 0x00, 0x6c/0x7c // read fuse  { 0x04, 0x4c, 0x00, 0x68/0x7a, 0x00, 0x6c/0x7c uint8_t cmd[] = { 0x08, 0x4c, 0x00, 0x0c, 0x00, 0x68, 0x00, 0x6c, }; uint8_t *pdata = chip_sig; uint8_t i; //____________________ read device signature for (i=0;i<3;i++) {   cmd[2] = i;   if (i)    *pdata++ = hv_cmd(&cmd;[2], 3);   else    *pdata++ = hv_cmd(cmd, 4); }//for uint8_t  id[] = { 0x07, 0x18, 0x26, 0x3b, 0x1b, 0x27, 0x3c, }; uint8_t mcu[] = { 0x13, 0x25, 0x45, 0x85, 0x24, 0x44, 0x84, }; if ((chip_sig[0] == 0x1e) && ((chip_sig[1]&0xf0) == 0x90) &&   !(chip_sig[2]&0xf0)) {   chip_sig[1] <<= 4;   chip_sig[1] |= chip_sig[2];   /*   switch (chip_sig[1]) {    case 0x07: chip_sig[1] = 0x13; break;    case 0x18: chip_sig[1] = 0x25; break;    case 0x26: chip_sig[1] = 0x45; break;    case 0x3b: chip_sig[1] = 0x85; break;    case 0x1b: chip_sig[1] = 0x24; break;    case 0x27: chip_sig[1] = 0x44; break;    case 0x3c: chip_sig[1] = 0x84; break;    default: chip_sig[1] = 0xee; break;   }//switch   chip_sig[0] = 0x00;   */   for (i=0;i<7;i++) {    if (chip_sig[1] == id[i]) {     chip_sig[0] = i;     chip_sig[1] = mcu[i];    }//if   }//for   pdata--; }//if //____________________ reset fuse if (release_reset) {   cmd[0] = 0x40;   //________________ write fuse low bits   cmd[3] = 0x2c; cmd[5] = 0x64;   if (chip_sig[1] == 0x13 || chip_sig[1] == 0x44 || chip_sig[1] == 0x84)    cmd[2] = 0x6a;   else    cmd[2] = 0x62;   hv_cmd(cmd, 4); _delay_ms(50);   //________________ write fuse high bits   cmd[5] = 0x74; cmd[7] = 0x7c;   if (chip_sig[1] == 0x13)    cmd[2] = 0xff;   else    cmd[2] = 0xdf;   hv_cmd(cmd, 4); _delay_ms(50);   //________________ write fuse extended bits   if (chip_sig[1] != 0x13) {    cmd[5] = 0x66; cmd[7] = 0x6e;    cmd[2] = 0x01;    hv_cmd(cmd, 4); _delay_ms(50);   }//if }//if //____________________ read fuse cmd[0] = 0x04; cmd[2] = 0x00; cmd[3] = 0x68; cmd[5] = 0x6c;   // fuse low *pdata++ = hv_cmd(cmd, 3); cmd[3] = 0x7a; cmd[5] = 0x7c;   // fuse high *pdata++ = hv_cmd(cmd, 3); if (chip_sig[1] != 0x13) {   cmd[3] = 0x6a; cmd[5] = 0x6e;  // fuse extended   *pdata++ = hv_cmd(cmd, 3); }//if // done, turn things off PORTB |= HIV; PORTB &= ~(VCC|SDO); PORTD &= ~(SCI|SDI|SII); busy--; sei(); } uint8_t menu=0, loc=0; //__________________________________________________ void main(void) { TCCR0B |= 0x01; TIMSK  |= _BV(TOIE0); TCNT0   = 0x00; DDRA = PORTA = 0; DDRD = PORTD = 0; DDRB   = (VCC|HIV|SDO); //DDRB   = (VCC|SDO); PORTB  = HIV;  // 12v off _delay_ms(50); read_chip(0); sei(); while (1) {   //_____________ "state" bits LBTSRZPP   //              L - long hold, B - button, T - ticked, S - setup mode,   //              R - refresh,   Z - buzzer  PP - digit edit position   //   //_____________ "menu" bits TxxOxMMM   //              T   - in toggle mode   //              O   - option used   //              MMM - menu id (1-4)   if (state & ST_TICKED) {    state &= ~ST_TICKED;   }//if   if (state & ST_REFRESH) {    state &= ~ST_REFRESH;    dot = _BV(mode);    if (mode) {     seg2port(chip_sig[mode*2], 0x40);    }//if    else {     seg2port(POS__, 0);     seg2port(POS_t, 1);    }//else    seg2port(chip_sig[mode*2+1], 0x42);   }//if   //_____________________________________ check input   if (state & ST_BUTTON) { // needs attention    loc = 0;    if (state & ST_PRESSED) {     // normal pressed, rotate display mode     mode++;     if (mode >= 3) mode = 0;    }//if    else {     // pressed and held, reset fuse     mode = 0;     read_chip(1);     _delay_us(100);     read_chip(0);    }//else    state &= ~ST_BUTTON;    state |= ST_REFRESH;   }//if }//while }

Question by WWC    |  last reply