lpcware

SDI-12 communication with 1758

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Saurabh Dey on Sat May 30 02:37:32 MST 2015
Hi all,

I have a Campbell make sensor which has SDi-12 output.
I am trying to interface the sensor with my 1758 development board.
I also wrote a piece of code, but I am not able to get any output.
I am sending a simple command ?! and the output I am getting is the same Echo ?!
Kindly let me know what firmware and hardware changes are required so as to get the output.

Any suggestions will be appreciated.

[u]*Note: The characters in Bold is the code and the characters in bold & Italic is the output.[/u]

[u]Code: [/u]
void InitSDI12(void)
{
call_back_init(SDI12, SDI12_CALLTIME, "ms");
InitDirOut();
SDI12_TX_DISABLE;
}

unsigned int SDI12(void)

unsigned char RxData,Cmd[5]="?!",i=0; ///Here ?! is the command
unsigned int j=0;

SDI12_TX_ENABLE;
put_char(U2,'\r');
put_char(U2,'\n');

//The reason to send \r\n is beacuse the sensor also has RS232 o/p and in RS232 communication the sensor needs to be wake up after pressing Enter for 9-10 times continuously//

for(j =0 ; j < 10000; j ++);
printf("SDI cmd- ");
for(j =0 ; j < 50000; j ++);
for(i = 0;i < (strlen((const char *)Cmd));i++)
{
put_char(U2,Cmd);
printf("%c", Cmd);
}
for(j =0 ; j < 50000; j ++);
SDI12_TX_DISABLE;
for(j =0 ; j < 50000; j ++);
printf("\r\n");
printf("Waiting for Reply\r\n");

for(j =0 ; j < 50000; j ++);
while(get_char(U2,&RxData))
{
//put_char(U0, '$');
put_char(U0, RxData);
printf("\r\n");
}
printf("Data Received\r\n");
printf("\r\n");

return 0;
}

void InitDirOut(void)
{
//!<Set gpio direction>
gpio_dir(GPIO_DIR_PORT, GPIO_DIR_PIN, 1);//dir:- 0-input 1 output
}


[u]Output: [/u]

SDI cmd- ?!
Waiting for Reply



?
!
Data Received

Outcomes