Hello guys,
I'm working in a project with the ez430-cc2480 module, I know that it is obsolete but is what I have. The goal of this project is to measure an analog signal continously and as fast as possible in order to draw in the computer the signal wave with the data.
I'm using ZASA code with the changes needed to do this, but I'm having some problems.
This part of the code configure the ADC10, including the DTC (128 samples, also tried small number but didn't work):
void halReadBusV(void)
{
ADC10CTL0 &= ~ENC;
ADC10CTL0 = SREF_2 + ADC10ON + ADC10SHT_2 + MSC + REF2_5V + REFON + ADC10IE;
ADC10CTL1 = SHS_0 + ADC10SSEL_0 + INCH_2 + ADC10DIV_0 + CONSEQ_2;
ADC10DTC1=0x80;
ADC10CTL0 |= ENC + ADC10SC;
}
this part is the ADC interrupt:
INTERRUPT_ADC10()
{
halAdcVal = ADC10SA; //Direction of the first conversion
halEventFlags |= HAL_EVT_ADC; // Signal that the ADC sample is ready.
ADC10CTL0 = 0; // Disable the ADC
ADC10CTL0 = 0; // Turn off reference (must be done AFTER clearing ENC).
__low_power_mode_off_on_exit();
}
and here I move each conversion to the send buffer:
static void appSrceData(void)
{
uint16 tmp;
int i;
for (i=0;i<256;i++) //256 because each conversion is in 2 bytes
{
tmp=ADC10SA*25/1023;
srceReport[i]=(uint16)tmp;
i++;
}
halReadBusV();
#if APP_DATA_CNF
if (APP_SRCE)
{
// Increment the message handle so that the next message is unique.
zb_SendDataRequest (ZB_BINDING_ADDR, SRCE_REPORT_ID, appMsgHandle++,
AF_ACK_REQUEST, AF_DEFAULT_RADIUS, SRCE_REPORT_SZ, srceReport);
/* An RFD needs a timer to wake from sleep and poll the ZACCEL for the ZACCEL_SEND_DATA_CNF.
* An FFD will always be awake and ready to poll for it.
*/
if (appFlags & appLowPwrF)
{
halTimerSet(HAL_IDX_TIMER_APP, APP_REPORT_RETRY, HAL_TIMER_AUTO);
}
appMsgRtry = APP_RETRY_CNT;
appFlags |= appSendingF;
}
#else
zb_SendDataRequest (ZB_BINDING_ADDR, SRCE_REPORT_ID, appMsgHandle++,
0, AF_DEFAULT_RADIUS, SRCE_REPORT_SZ, srceReport);
appLedBlink(APP_DATA_LED);
#endif
}
- ¿Am I moving the data correctly?
- Z-Tool only shows the data when I send 64 conversions, but if I try to send more than 100 more or less, the data doesn't appear in Z-Tool. Why?
THANKS !!!!!!!