Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hello,
I am trying to connect a CO2 sensor (an external device) to the Hercules MCU board. I connect both devices as they are supposed to, based on each device's schematic; however, after writing the code I do not know how to see if any information has been transferred between these two devices. I was wondering if someone could tell me how to test this and see the results of the interaction between both devices. Also, for anybody to check my code, and tell me a list of steps that I should follow when setting up HALCoGen (I want to ensure that I did it correctly). I am using SCI3. I have pasted my code below and already seen the training for UART using SCI communication multiple times and it is not too helpful. Thank you in advance.
int main(void)
{
/* USER CODE BEGIN (3) */
//Enables interrupts
_enable_IRQ();
//Initializes SCI
sciInit();
//Sets up CO2 sensor to streaming mode (commands are processed when received and measurements are recorded constantly)
sciSend(sciREG3, 8, (unsigned char *)"K 1\r\n"); // the Strings refers to commands that I have to send to the CO2 sensor to set it up correctly
//Sets up CO2 sensor to send digitally filtered CO2 readings
sciSend(sciREG3, 8, (unsigned char *)"Z\r\n");
//Returns the most recent CO2 measurement
sciReceive(sciREG3, 8, rxBuffer);
while(1);
/* USER CODE END */
return 0;
}
/* USER CODE BEGIN (4) */
void sciNotification(sciBASE_t *sci, unsigned flags)
{
//Received character
sciSend(sci, 1, rxBuffer);
//Awaits next character
sciReceive(sci, 1, rxBuffer);
}
/* USER CODE END */