pic temperature controller for sale

Here are the most important points about pic temperature controller ,From here you will get the item specifics like description,function ,value and some other most effective associated products ,you will get the information that which is the proper to buy and obtain the discount value.

if you wish to study additional testimonials about pic temperature controller or relevant product,it can be easy to click around the image and get far more info in regards to the goods which you intriguing,if you would like to buy the product ,you’ll need to study far more reviews.

Rating:
Reviews: customer reviews...
List Price: unavailable
Sale Price: Too low to display.
Availability: unspecified

Product Description

No description available.

Details

No features available.

There was an error connecting to the Amazon web service, or no results were found for your query.

This blog started out as a uncomplicated repository of easy data, then it grew to grow to be a spot on the internet that’s definitely dedicated to %keywords%. We thank definitely every person who contributed to our blog and also the folks who painstakingly take time for you to read and comment – to produce our web site the best that it may be.

blue_rose_69 asked What does a firmware engineer do?

I know they write sw that controls hw.. but does anyone have any examples/sample c++ code?

And got the following answer:

since you already know what firmware engineer do, I will spare you the mambo jambo crap definition. Anyways here is a code sample written in C by Michael Pearce to control Heater controller. click the link below to find other firmware example for IBM and other companies Good luck ......................................................................................................... #define VERSION "\r\nV1.2.4.B\r\n" //************************************************************************* // Heater Controller // Version 1.2.4.B // 11 December 2000 // // Info: A PIC12c6xx Based Heater Controller that uses a single DS1820 // temperature probe and a simple P.I.D calculation and Full Wave // Pulsed output via Triac. // Control can hold to +/- 1 degree in optimum situation, but is very // situation dependant so expect no better than +/- 2 degrees after // settling time. // // Author: Michael Pearce // Chemistry Department, University Of Canterbury // // Started: 3 November 2000 // //************************************************************************* // VERSION INFORMATION //************************************************************************* // Version 1.2.4.B - 11 December 2000 // Added Error Number Display for debugging Purposes //************************************************************************* // Version 1.2.3.B - 8 December 2000 // Lengthend time out a little, decreased Error Size in CRC Check // Changed the reseting of error counter, so that it only minuses values // rather than resetting to zero, this should hopefully speed up the // response when water is drained out of the system // Also set Error check power level to 70% cause when at temperature it // seems to settle at around 40-50% with target of 80 degrees. //************************************************************************* // Version 1.2.2.A - 7 December 2000 // Changed Temperature Limits to 80degrees MAX // POT Range 20 - 80 Degrees //************************************************************************* // Version 1.2.1.A - 7 December 2000 // Changed Error Checking when Bad Checksum //************************************************************************* // Version 1.2.0.A - 6 December 2000 // Added OSCCAL Calibration - hopefully will fix timing probs // Added titles to Functions - Looking at Setting up timer Correction. //************************************************************************* // Version 1.1.1 - 7 November 2000 // Added Extra 10 seconds delay on Power up before error checking occurs //************************************************************************* // Version 1.1.0 - 6 November 2000 // Added WDT and Sensor Checking. // Re-arranged the RS232 Sending routines to handle Constants //************************************************************************* // Version 1.0.0 - 3 November 2000 // Got the Basics working, operates quite well, when settles has a // +/- 1 degree swing (or less). //************************************************************************* #define XTAL_FREQ 4MHZ #define LOOP_SEC 2 //-- Approx Main Loops per second #define ERROR_COUNT_MAX 38 * LOOP_SEC //-- Max time For Temp Increase #define ERROR_START_DELAY 20 * LOOP_SEC //-- An additional delay Pwr Up #define ERROR_TRIGGER_PWR 70 //-- 70% power is area for error chk #define CRC_ERR_ADD 4 //-- Amount to add to Error counter if CRC Error #include #include #define P_GAIN 4 #define D_GAIN 4 #define I_GAIN 2 #define I_COUNT_MAX 2 //-- # of intervals before increasing I #define I_COUNT_DEC 4 //-- # times longer to wait b4 decrementing #define I_VALUE_MAX 40 //-- Max Integral Value - Limits overshoot #define CONTROLED_BAND 15 //-- Temperature band around Target that // is controlled (2 units per degree!!) #define MAX_TEMP (80 * 2) //-- Max Temperature of 80 Degrees #define MAX_POT_TEMP MAX_TEMP //-- Max Target Temperature #define POT_DIVIDER 4 //-- Divide the Pots Value to get temp range #define POT_SHIFT 20 //-- Shift up by this num of degrees //-- Note: Value is multiplied by 2 in the // function to get 1/2 Degree resolution. #define BURST_TOTAL_RELOAD 100 //-- Number of cycles per Run #define BURST_PERCENT_DIVIDER 1 //-- Amount to div POWER to get count #define BURST_TIMER_RELOAD (-2) //-- 2 counts per Full Wave #define BURST_POWER_ON 100 //-- MAX POWER SETTING #define BURST_POWER_OFF 0 //-- MIN POWER SETTING #define OUTPUT_ON 0 #define OUTPUT_OFF 1 #ifndef BITNUM #define BITNUM(adr, bit) ((unsigned)(&adr)*8+(bit)) #endif //*********************** Ports ****************************** static bit POTINPUT @ BITNUM(GPIO,0); // POT input to ADC static bit T_POTINPUT @ BITNUM(TRIS,0); // The tris for above static bit PROBEINPUT @ BITNUM(GPIO,1); // PROBE INPUT - Dig &/or Analog static bit T_PROBEINPUT @ BITNUM(TRIS,1); // The tris for above #define D_PIN PROBEINPUT #define D_TRIS T_PROBEINPUT static bit ZEROCROSSIN @ BITNUM(GPIO,2); // INPUT to Timer 4 Zero Cross static bit T_ZEROCROSSIN @ BITNUM(TRIS,2); // The tris for above static bit RS232_RX @ BITNUM(GPIO,3); // RS232 Recieve Pin static bit T_RS232_RX @ BITNUM(TRIS,3); // The tris for above static bit OUTPUT_PIN @ BITNUM(GPIO,4); // OUTPUT to the TRIAC static bit T_OUTPUT_PIN @ BITNUM(TRIS,4); // The tris for above static bit RS232_TX @ BITNUM(GPIO,5); // RS232 Transmit Pin static bit T_RS232_TX @ BITNUM(TRIS,5); // The tris for above #include "delay.c" #include "1wire.c" #include "checksum.c" // VARIABLES bit OverFlow; unsigned char BURST_ON_NEXT; //-- Reload value for _COUNT unsigned char BURST_ON_COUNT; //-- Number of counts to be ON unsigned char BURST_TOTAL_COUNT; //-- Total number of Counts to do unsigned char BURST_PREVIOUS_SETTING; //-- the previous power setting unsigned char Intergral; unsigned char I_Counter; unsigned char ErrorCounter; unsigned char LastTemperature; //******* FUNCTIONS *********** unsigned char ReadADC(void); void SendNum(unsigned char num); void MM_ctoa(unsigned char val, char *str); void RS232_Send(char *Data); unsigned char Calculate(unsigned char TARGET,unsigned char CURRENT); void Burst_Output (unsigned char Percentage); unsigned char ReadProbe(unsigned char OldCurrent); void CheckTimeOut(unsigned char target, unsigned char current,unsigned char power); void SendData(unsigned char target, unsigned char current,unsigned char power); void RS232_SendConst(const char *constr); const char Str_Target[]="\rTarget:"; const char Str_Current[]="Current:"; const char Str_Power[]="Power%:"; const char Str_OverFlow[]="\r\nWDT\n"; const char Str_ErrorCount[]="ErrCnt:"; const char Str_Error[]=" ERROR!\n"; const char Str_Start[]=VERSION; //***************************************************************** // main //***************************************************************** void main (void) { unsigned char target,current,power; unsigned char PwrUpDly; OverFlow=0; if(TO==0) { OverFlow=1; } else { PwrUpDly=ERROR_START_DELAY; //- Only Do on POWER UP - } CLRWDT(); OPTION=0x3F; TRIS=0xFF; GPIO=0xFF; OSCCAL=_READ_OSCCAL_DATA(); //- Load Osccal //****** Initialise ports ********** POTINPUT=1; T_POTINPUT=1; PROBEINPUT=1; T_PROBEINPUT=1; OUTPUT_PIN=1; T_OUTPUT_PIN=1; ZEROCROSSIN=1; T_ZEROCROSSIN=1; RS232_TX=1; T_RS232_TX=1; RS232_RX=1; T_RS232_RX=1; GPPU=1; //-- Disable pull ups - all pins that would use it don't need it! ADCON1=0b00000110; //-- GPIO.0 is the only Analog Input by Default ADCON0=0b00000001; //-- Fastest sample rate - Turn ADC ON //****** Initialise Variables *********** BURST_ON_NEXT=0; //-- Reload value for _COUNT BURST_ON_COUNT=0; //-- Number of counts to be ON BURST_TOTAL_COUNT=BURST_TOTAL_RELOAD; //-- Total number of Counts to do BURST_PREVIOUS_SETTING=0; //-- the previous power setting Intergral = 0; //****** Enable Interrupts ******** INTCON=0x00; T0IE=1; GIE=1; if(OverFlow) { OverFlow=0; CLRWDT(); RS232_SendConst(Str_OverFlow); } RS232_SendConst(Str_Start); ErrorCounter=0; //******* MAIN LOOP ******** while(1) { CLRWDT(); target=ReadADC(); current=ReadProbe(current); power=Calculate(target,current); if(PwrUpDly > 0) //-- Do not check for Errors till after Power up delay { PwrUpDly--; } else { CheckTimeOut(target,current,power); //-- Check After successful power up } Burst_Output(power); SendData(target,current,power); } } //*************************************************************************** // ReadADC //*************************************************************************** unsigned char ReadADC(void) { unsigned char temp; CHS1=0; //-- Select Channel 0 CHS0=0; ADON=1; //-- Turn the ADC on CLRWDT(); //-- Clear the Watch Dog to allow time to convert b4 reset GODONE=1; //-- Start the Conversion while(GODONE); //-- Wait for Conversion to complete temp=((ADRES/POT_DIVIDER)+POT_SHIFT) * 2; //-- Calculate the Range if(temp > MAX_POT_TEMP) { temp=MAX_POT_TEMP; } return(temp); } //******************************************* //*************************************************************************** // SendData //*************************************************************************** void SendData(unsigned char target, unsigned char current,unsigned char power) { RS232_SendConst(Str_Target); SendNum(target/2); RS232_SendConst(Str_Current); SendNum(current/2); RS232_SendConst(Str_Power); SendNum(power); RS232_SendConst( Str_ErrorCount); SendNum(ErrorCounter); } //*************************************************************************** // RS232_SendConst //*************************************************************************** void RS232_SendConst(const char *constr) { char string[10]; strcpy(string,constr); RS232_Send(string); } //*************************************************************************** // SendNum //*************************************************************************** void SendNum(unsigned char num) { char string[5]; MM_ctoa(num, string); RS232_Send(string); } //*************************************************************************** // MM_ctoa // // char to Ascii - Base 10 Conversion only //*************************************************************************** void MM_ctoa(unsigned char val, char *str) { signed char tmp; tmp=val/100; *str=tmp+'0'; str++; val-=(tmp*100); tmp=val/10; *str=tmp+'0'; str++; val-=(tmp*10); tmp=val; *str=tmp+'0'; str++; *str=' '; //-- Space str++; *str=0; //-- Null Pointer } //********************************************************************** // ReadProbe //********************************************************************** unsigned char ReadProbe(unsigned char OldCurrent) { unsigned char DATA[8],CRC,count; CLRWDT(); D_Reset(); //-- Reset Bus D_Write(0xCC); //-- Skip Rom D_Write(0x44); //-- Convert temperature DelayMs(200); //-- Time To convert the temperature DelayMs(200); DelayMs(200); D_Reset(); //-- Read in the data D_Write(0xCC); //-- Skip Rom D_Write(0xBE); //-- Read Scratch pad CLRWDT(); for(count=0;count<8;count++) { DATA[count]=D_Read(); } CRC=D_Read(); if( CRC == PROBE_CHECKSUM(DATA,sizeof(DATA)) ) { if(DATA[1]==0) //-- Check for a negative Flag { return(DATA[0]); //-- If not Negative return the Value } else { return(0); //-- If negative then return 0 } } else { ErrorCounter+=CRC_ERR_ADD; //-- If Bad CRC - is possible bad probe so add error } return(OldCurrent); } //******************** End of Read Probe ********************* //*************************************************************** // RS-232 Defines //*************************************************************** #defineXTAL4000000 #defineBRATE9600 #defineDLY3/* cycles per null loop */ #defineTX_OHEAD13/* overhead cycles per loop */ #defineRX_OHEAD12/* receiver overhead per loop */ #defineDELAY(ohead)(((XTAL/4/BRATE)-(ohead))/DLY) //*************************************************************** // RS232_Send //*************************************************************** void RS232_Send(char *Data) { unsigned chardly, bitno; char c; while(*Data !=0) //-- Send data till Null is found { CLRWDT(); c=*Data; bitno = 11; RS232_TX=1; //-- Ensure Data High to start with T_RS232_TX=0; //-- Ensure data is in output mode RS232_TX = 0;/* start bit */ bitno = 12; do { dly = DELAY(TX_OHEAD);/* wait one bit time */ do /* nix */ ; while(--dly); if(c & 1) { RS232_TX = 1; } else { RS232_TX = 0; } c = (c >> 1) | 0x80; } while(--bitno); Data++; //-- Point to next data byte } } //**************************************************************** // Calculate //**************************************************************** unsigned char Calculate(unsigned char TARGET,unsigned char CURRENT) { unsigned char POWER; CLRWDT(); if(TARGET >= CURRENT) { if(CURRENT < (TARGET-CONTROLED_BAND)) { POWER=100; Intergral=0; } else { if(CURRENT != TARGET) { if(I_Counter++ > I_COUNT_MAX) { I_Counter=0; //-- Counter slows the response of I Intergral++; //-- Only Increase Integral if less than target if(Intergral > I_VALUE_MAX) Intergral=I_VALUE_MAX; } } //-- P.I.D Proportional Integral Derivative POWER=((TARGET / CURRENT) * P_GAIN) + (Intergral * I_GAIN) + ((TARGET - CURRENT) * D_GAIN) ; } } else { POWER=0; if(I_Counter++ > (I_COUNT_MAX*I_COUNT_DEC)) //-- Slower decrease of value { I_Counter=0; //-- Counter slows the response of I if(Intergral !=0)Intergral--; } } if(POWER > 100) POWER =100; if(CURRENT > MAX_TEMP) POWER=0; return(POWER); } //********************************************************** void Burst_Output (unsigned char Percentage) { CLRWDT(); if(Percentage != BURST_PREVIOUS_SETTING) //-- Check if need to change { BURST_PREVIOUS_SETTING=Percentage; //-- Need to change so store BURST_ON_NEXT=Percentage/BURST_PERCENT_DIVIDER; // All of the new settings if(BURST_ON_NEXT > BURST_TOTAL_RELOAD) //-- Check if in limit { BURST_ON_NEXT = BURST_TOTAL_RELOAD; //-- else set to the limit } } } //********************************************************** void interrupt MyInterruptRoutine(void) { GIE=0; //-- Timer 0 Overflow -- Used for zero cross detection if(T0IF) { T0IF=0; TMR0=BURST_TIMER_RELOAD; //-- Reload timer for Net Wave Trigger if(BURST_ON_COUNT!=0) //-- Check if need to Enable Output { BURST_ON_COUNT--; //-- If so Decrement count by one T_OUTPUT_PIN=0; //-- Ensure TRIS set to OUTPUT OUTPUT_PIN=OUTPUT_ON; //-- and enable the output } else { OUTPUT_PIN=OUTPUT_OFF; //-- Else disable the output } BURST_TOTAL_COUNT--; //-- Decrement the total count if(BURST_TOTAL_COUNT==0) //-- Check if time is up { BURST_TOTAL_COUNT=BURST_TOTAL_RELOAD; //-- if so relead the total count BURST_ON_COUNT=BURST_ON_NEXT; //-- and reload the NEXT ON count } } GIE=1; } //************************************************************ void CheckTimeOut(unsigned char target, unsigned char current,unsigned char power) { if(power > ERROR_TRIGGER_PWR || ErrorCounter > ERROR_COUNT_MAX) { if(LastTemperature >= current || ErrorCounter >ERROR_COUNT_MAX) { ErrorCounter++; if(ErrorCounter > ERROR_COUNT_MAX) { //***************** ERROR OCCURED ************************ power=0; while(1) { CLRWDT(); Burst_Output(0); //-- Set Output Power to ZERO RS232_SendConst(Str_Error); //-- Indicate Error DelayMs(10); //-- Short delay between Messages } //******************************************************** } } else { LastTemperature = current; if(ErrorCounter > 15) { ErrorCounter-=15; //-- Hopefully will help speed up response to // Sensor out errors etc } else { ErrorCounter=0; } } } else { if(ErrorCounter > 10) { ErrorCounter-=10; //-- Hopefully will help speed up response to // Sensor out errors etc } } }

There was an error connecting to the Amazon web service, or no results were found for your query.

Tagged , , , , , , , , , , , , . Bookmark the permalink.

Comments are closed.