problem of using comarator in 16f88
Posted: Mon Feb 28, 2011 1:22 pm
hello, i have configured the comparator register but i have no ideas of how to read the input and output. my program is below
#include <system.h>
#include "RF transmitter.h"
void setup_hardware (void)
{
/* set all of PORTB for output */
trisb = 0x00 ;
/* bits 0-2 of PORTA for input and bit 3 of portA for output which is C1OUT */
trisa = 0x05;
/* Just A0 and A3 ( comparator voltage reference) in analogue mode */
ansel = 0x05 ;
portb=0x00;
cmcon = 0x46;
}
void main ( void )
{
int v;
setup_hardware () ;
while (1) {
what should be here ?????????????????????????????? }
}
#include <system.h>
#include "RF transmitter.h"
void setup_hardware (void)
{
/* set all of PORTB for output */
trisb = 0x00 ;
/* bits 0-2 of PORTA for input and bit 3 of portA for output which is C1OUT */
trisa = 0x05;
/* Just A0 and A3 ( comparator voltage reference) in analogue mode */
ansel = 0x05 ;
portb=0x00;
cmcon = 0x46;
}
void main ( void )
{
int v;
setup_hardware () ;
while (1) {
what should be here ?????????????????????????????? }
}