AnsweredAssumed Answered

adas1000 and pic microcontroller

Question asked by Tolu on May 19, 2015
Latest reply on May 20, 2015 by DragosB

Hello,

i am working on a project to measure and display ecg data on a pc GUI .

I am using ADAS 1000 and pic 24fj64gb002. I have been struggling with the code as it refuse to build.

Its been generating errors when building with Mplabx.

I will like advice on what mistake I am making.

Please find below the code I am working on.

Thanks

Tolu

[

 

#include "p24FJ64GB002.h

 

#include "xc.h"

 

#include "PPS.h"

 

#include "spi.h"

 

#include "ADAS1000.h"

 

#define ADAS_CS_TRIS TRISBbits.TRISB2 = 0 //Chip Select an output on RB2 pin

 

#define ADAS_CS PORTBbits.RB2 //Chip Select on RB2 pin

 

void ADAS_SPI_ENABLE()

 

SPI1STATbits.SPIEN = 1; //ENABLE SPI1

 

void ADAS_SPI_DISABLE()

 

SPI1STATbits.SPIEN = 0; //DISABLE SPI1

 

void ADAS_PPS_INIT()

 

__builtin_write_OSCCONL(OSCCON & 0xBF); //Unlock Registers

 

RPINR20bits.SDI1R = 7; //SDI1 on RP07 PIN16

 

RPOR5bits.RP10R = 7; //SDO1 on RP10 PIN21

 

RPOR5bits.RP11R = 8; //SCK1 on RP11 PIN22

 

__builtin_write_OSCCONL(OSCCON | 0x40); //Lock Registers

 

void ADAS_SPI_INIT()

 

ADAS_SPI_DISABLE(); //Disable SPI Port

 

SPI1BUF = 0; //Clear SPI Buffer

 

IFS0bits.SPI1IF = 0; //Clear Interrupt Flag

 

IEC0bits.SPI1IE = 0; //DISABLE INTERRUPT

 

SPI1STATbits.SPIROV = 0;//Clear OverFlow Bit

 

ADAS_SPI_ENABLE(); //ENABLE SPI PORT

 

void ENABLE_ADAS()

 

ADAS_CS = 0; //SELECT ADAS1000 CHIP

 

void DISABLE_ADAS()

 

ADAS_CS = 1; //DESELECT ADAS1000 CHIP

 

void ADAS_ECGCTL_INIT()

 

ADAS_SPI_INIT(); //READY ADAS-MCU SPI COMMUNICATION

 

ENABLE_ADAS(); //ENABLE ADAS1000 SPI COMMUNICATION

 

WriteSPI1(ECGCTL1); //WRITE 4-BYTE CMD TO ECGCTL CONTROL REGISTER

 

ReadSPI1(); //READ SPI1BUF TO CLEAR FLAGS

 

DISABLE_ADAS(); //DISBALE ADAS1000 SPI COMMUNICATION

 

void ADAS_FRMCTL_INIT()

 

ADAS_SPI_INIT(); //READY ADAS-MCU SPI COMMUNICATION

 

ENABLE_ADAS(); //ENABLE ADAS1000 SPI COMMUNICATION

 

WriteSPI1(FRMCTL1); //WRITE 4-BYTE CMD TO FRMCTL CONTROL REGISTER

 

ReadSPI1(); //READ SPI1BUF TO CLEAR FLAGS

 

DISABLE_ADAS(); //DISBALE ADAS1000 SPI COMMUNICATION

 

void ADAS_INIT()

 

void ADAS_READ_DATA()]

 

Outcomes