1. Set ADC channel to Temperature sensor input.
2. Wait Tad cycles (see PIC datasheet).
3. Start A/D conversion.
4. When A/D conversion finishes, get value and store.
5. Set ADC channel to Occupancy sensor input.
6. Wait Tad cycles (see PIC datasheet).
7. Start A/D conversion.
8. When A/D conversion finishes, get value and store.
9. Repeat from step 1.
Somewhere inside this loop you'll want to use the values you got to achieve whatever function your project is meant to do.
hi what language are you using for programming? a few things to help you get started are. you have to make the ADC pins anologue as opposed to digital (see datasheet) you will have to make the anologue pins input (TRIS register). if you using C18 microchip supplies ADC libs wich may help you out
hi what language are you using for programming? a few things to help you get started are. you have to make the ADC pins anologue as opposed to digital (see datasheet) you will have to make the anologue pins input (TRIS register). if you using C18 microchip supplies ADC libs wich may help you out
1. Set ADC channel to Temperature sensor input.
2. Wait Tad cycles (see PIC datasheet).
3. Start A/D conversion.
4. When A/D conversion finishes, get value and store.
5. Set ADC channel to Occupancy sensor input.
6. Wait Tad cycles (see PIC datasheet).
7. Start A/D conversion.
8. When A/D conversion finishes, get value and store.
9. Repeat from step 1.
Somewhere inside this loop you'll want to use the values you got to achieve whatever function your project is meant to do.
Do you no how to use VB? If so I would try Swordfish Basic and reading temp would be easy
Code:
Function ADC_value() As Word
result = ((ADC.Read(0)*4300)/1023)/10
End Function
Dim ADVal As Word
Dim temp As Word
// main program loop - this just simply reads a byte from a
// terminal window (for example, SerialCommunicator) and then
// echo it back...
TRISA = %00000011 // configure AN0 as an input
ADCON1 = %00001101 // set analogue input on PORTA.0
While true
temp = ADC_value
DelayMS(100)
Writebyte(temp)
DelayMS(1000)
Wend