Lookup Tables??? HELP!

Status
Not open for further replies.
chevymn1964 said:
Tested the thermistor and the resistance decreces as it gets warmer...
You're not trying very hard to figure this out. Why can't you make the DVM measurement?
 

Okay.... I hooked up my meter and this is what I found.... At ambient temp (about 57F in my shop) I get 2.135VDC, when I place my fingers on the thermister it rises to 2.900VDC... I believe that it would indicate that when the temp increases the resistance would decrease witch in turn indicate that the themister is in fact a NTC right?
 

I dont know pic asm and dont want to study it), but i advice (durty trick) you to reverse constant positions in lookup table and see whats happened .

and check once did you reverse inversed and noninversed adc inputs?
 

ok, here's the scoop.... The problems I am having are after I made some changes to the original software... The changes I made are when the subroutine DisplayTemp is called. When it is called for the 3rd time and when the clrf PCLATH, call CTable are called apon the program gets stuck in a loop... So, I deleted the clrf PCLATH wich worked but the temp is displayed -50 and so on... lol sorry for the mess everone, Im new to this programming stuff and I'm learning as I go lol Has anyone loaded this code and tryed to run it in MPLAB?
 


Yes, I simulated your code in mplab and found some error.
The table is created for a range of 0X01 to 0XF8
and when the adc value reaches to it's maximum(0XFF) or more than 0XF8 it will
hang there. I solved the problem in simulator.before accessing the value from table I checked the value of w weather it's below 0XF8 or above. and corrected the problem. the code addition is below.
you have to add this code in your program.
and you have add a temp register too as shown below.

Code:
;  Parameters: ADC reading in W
;  Returns:    Nothing
DisplayTemp
        clrf   PCLATH        ;Conversion table is in 1st page
;.....ROUTINE TO CHECK VALUE
CHECK
	movwf Temp3
	andlw b'11111000'
	xorlw b'11111000'
	btfss STATUS,Z
	goto RESTORE
	goto CORRECT_VALUE
;.......IF VALUE EXCEEDS 0XF8, MAKE IT 0XF8
CORRECT_VALUE
	movlw 0XF8
	goto VERIFIED
;........OTHERWISE RESTORE ORIGINAL VALUE
RESTORE
	movf Temp3,W
	goto VERIFIED
;...........................
VERIFIED	 call   CTable        ;Goto jump table for Celsius Temperature

	movwf  L_Byte        ;Load binary data for BCD conversion

temp register as follows:


LowAlarm equ 28 ;Stored as ADC values, not actual temps.
AlarmOn equ 27
Temp2 equ 26 ;temp storage
Temp3 equ 25 ;Temp storage for table correction
 

OK! Thanks for the help! I would have never figured that out... I tried the addition that was suggested and I am happy to say that its not displaying a negitive number now.... The problem Im having now is when you incriment and decrement the "SET" temp. It seems that it dont want to adjust.... HUMMMMMMMM

Added after 9 minutes:

oopps I spoke too soon! I messed with it again and everytings ok when you try to adjust the set temp it does act kinda funny but it works great! thanks again!!!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…