| Electronic Components Datasheet Search |
|
AN897 Datasheet(PDF) 6 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN897 Datasheet(HTML) 6 Page - Microchip Technology |
|
6 / 16 page ![]() AN897 DS00897B-page 6 2004 Microchip Technology Inc. FLOWCHARTS The second design’s flowchart is shown in Figure 15. It is very similar to the first design program, with the exception that it has added a PGA hysteresis routine. The firmware is available in the 00897.zip file. The firmware was written in relocatable assembly code. The main.asm file controls the overall program flow. The PGA routines are in pga.inc and pga.asm. The thermistor routines are in Therm_PGA2.inc and Therm_PGA2.asm . FIGURE 15: Flowchart for Second Design. The Signal Analysis PC Program commands the PIC16F684 firmware to perform a real-time sample. The firmware reads the ADC value and passes it to the PGA hysteresis routine. Figure 16 shows the detail of the PGA hysteresis routine. The routine checks to see what PGA gain is set (the variable “PGAgain”). Based on PGAgain, the ADC value is tested for end-point (trip) values. If the ADC value is beyond the trip point value, PGAgain is set to the next higher or lower gain setting. Upon exiting the PGA hysteresis routine, the firmware checks if PGAgain was changed. If there was no change (Return 0), the program continues. If there was a change (Return 1), the firmware re-reads the ADC. Once the PGA gain and ADC value are known, both values are passed to the piece-wise linear interpolation routine. Based on the PGA gain setting, the correct look-up table is referenced. The PwLI routine converts the 10-bit ADC value into a 16-bit fixed decimal point degrees Celsius value. The fixed decimal point format reports degrees Celsius in tenths of a degree. Performing the piece-wise linear interpolation in tenths of a degree provides better resolution of degrees Celsius. Finally, the 16-bit degrees Celsius value is sent to the Signal Analysis PC Program for display on the real-time strip chart graph. In the final design, the designer can elect to receive reports in tenths of a degree or that they be rounded up into whole degrees. FIGURE 16: Flowchart for Second Design’s PGA Hysteresis Subroutine. Read ADC Perform PwLI Send °C to Strip Chart End PGA Hysteresis Yes No Was PGAgain Changed? Start Get Real Time Sample PGA Hysteresis IF PGAgain = 1 Set PGAgain = 8 IF PGAgain = 8 IF PGAadc < 113 IF PGAadc < 226 IF PGAadc > 960 IF PGAgain = 32 IF PGAadc > 960 Set PGAgain = 32 Set PGAgain = 1 Set PGAgain = 8 Return 0 Return 1 Y N Y N Y N Y N Y N Y N Y N |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |