Subversion Repositories Code-Repo

Rev

Rev 121 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include "maindefs.h"
#include "msg_queues.h"
#include "adc.h"
#include <adc.h>

void adc_init() {
    TRISAbits.TRISA0 = 1;
    
    OpenADC(ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_0_TAD,
            ADC_CH0 & ADC_INT_ON & ADC_REF_VDD_VSS, 0,
            ADC_1ANA);
}

void adc_start() {
    ConvertADC();
}

void adc_stop() {
    CloseADC();
}

void adc_interrupt_handler() {
    // Sends the ADC value to main()
    unsigned int ret;
    unsigned char length;
    ret = ReadADC();
    length = 2;
//    MQ_sendmsg_ToMainFromLow(length, MSGTYPE_ADC_NEWVALUE, &ret);
}