Kingdom Man
New Member
Hello all! I am just a new beginner and am very exited about all this programming, I have been working through some problems and have made some success on my own but now I am looking for some help.
Here is my code, I know its super simple to you guys, but like I said Im learning...
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
start
banksel PORTA
clrf PORTA ;Init PORTA
banksel ANSEL ;Bank 2
clrf ANSEL ;digital I/O
bsf STATUS,RP0 ;Select register page 1
clrf TRISC ;set I/O pins on PORTC to output
movlw b'00000001'
movwf TRISA ;set I/O pin RA0 to input
bcf STATUS,RP0 ;back to register page 0
movlw b'00001111'
movwf PORTC ;set i/o pins RC0-RC3 high
goto run
run:
btfsc PORTA,0 ;skip next if PORTA high
movlw b'00001111'
movwf PORTC ;set all portc high
btfss PORTA,0 ;skip next if PORTA low
movlw b'00000000'
movwf PORTC ;set i/o pins RC0-RC3 low
goto run ;keep checking input status
end
this code works for setting all my output pins high on port c when the input on port a is in a certain state High or low, but what I want to learn how to do now is set the input pin to monitor a thermistor, and I want to be able to learn how to set different setpoints for my output. for instance if I want to trigger my outputs high when the input see`s 2 volts how do i do this?
Here is my code, I know its super simple to you guys, but like I said Im learning...
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
start
banksel PORTA
clrf PORTA ;Init PORTA
banksel ANSEL ;Bank 2
clrf ANSEL ;digital I/O
bsf STATUS,RP0 ;Select register page 1
clrf TRISC ;set I/O pins on PORTC to output
movlw b'00000001'
movwf TRISA ;set I/O pin RA0 to input
bcf STATUS,RP0 ;back to register page 0
movlw b'00001111'
movwf PORTC ;set i/o pins RC0-RC3 high
goto run
run:
btfsc PORTA,0 ;skip next if PORTA high
movlw b'00001111'
movwf PORTC ;set all portc high
btfss PORTA,0 ;skip next if PORTA low
movlw b'00000000'
movwf PORTC ;set i/o pins RC0-RC3 low
goto run ;keep checking input status
end
this code works for setting all my output pins high on port c when the input on port a is in a certain state High or low, but what I want to learn how to do now is set the input pin to monitor a thermistor, and I want to be able to learn how to set different setpoints for my output. for instance if I want to trigger my outputs high when the input see`s 2 volts how do i do this?