JohnJohn20
Advanced Member level 4
- Joined
- Feb 2, 2012
- Messages
- 111
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Activity points
- 2,377
Hi. I wish to use the ADC capability of a PIC16F88 chip to measure voltage across a thermistor.
Because the thermistor voltage/temperature curve is not linier, I think I will have to compare the measurement (a 10 bit number) with up to 100 known values (if I want 1 degree C accuracy) like this: (I am sure there are more efficient ways but for the sake of argument.....)
If X > 100 Then Temp = 100
Else If X > 99 Then Temp = 99
Else If X > 98 Then Temp = 98
Else If X > 97 Then Temp = 97
Else If X > 96 Then Temp = 96
Else If X > 95 Then Temp = 95
etc. But this makes the program large. The PIC16F88 datasheet says that the Program memory has:
- Flash 7168 bytes and
- the # Single-word Instructions = 4096.
So how many instruction lines can I put in a program?
For example, how much memory space do these instructions use (or, how many instruction words are each of these steps)?
movlw 0xFE ; 11111110
movwf TRISA
bcf STATUS, RP1 ;
movlw 0x01 ;
movwf PORTA
btfsc PORTA,3
call Delay1
call Delay2
Thanks.
Because the thermistor voltage/temperature curve is not linier, I think I will have to compare the measurement (a 10 bit number) with up to 100 known values (if I want 1 degree C accuracy) like this: (I am sure there are more efficient ways but for the sake of argument.....)
If X > 100 Then Temp = 100
Else If X > 99 Then Temp = 99
Else If X > 98 Then Temp = 98
Else If X > 97 Then Temp = 97
Else If X > 96 Then Temp = 96
Else If X > 95 Then Temp = 95
etc. But this makes the program large. The PIC16F88 datasheet says that the Program memory has:
- Flash 7168 bytes and
- the # Single-word Instructions = 4096.
So how many instruction lines can I put in a program?
For example, how much memory space do these instructions use (or, how many instruction words are each of these steps)?
movlw 0xFE ; 11111110
movwf TRISA
bcf STATUS, RP1 ;
movlw 0x01 ;
movwf PORTA
btfsc PORTA,3
call Delay1
call Delay2
Thanks.
Last edited: