Shafeer
December 15, 2009, 2:55am
1
I have a Wavecom fastrack supreme 10 and am going to connect my Module to a PIC18F52 module via serial connection. I need the module to send data through the serial connection. Anyone got a simple code? Ive been searching but all i could find was codes to read from the module.
The PIC18F452 is configured as, 8N1, 2400 baud, in polled mode
MariMax
December 15, 2009, 4:48am
2
Approximately so:
void SendAlertSms ()
{
adl_smsSend(sms_Handle,PhoneNumber,"Alert!",ADL_SMS_MODE_TEXT);
}
void SendTCPData ()
{
wip_write(Channel,"Alert!",strlen("Alert!"));
}
bool FCM_data_Handler(u16 datalength, u8 *data)
{
if(*data == 48) adl_fcmSwitchV24State(FCMhandle, ADL_FCM_V24_STATE_AT); //switch to at mode when '0' - key click
{
SendAlertSms();
/*or
SendTCPData ();*/
}
return TRUE;
}
bool FCM_ctrl_Handler(u8 event)
{
adl_fcmReleaseCredits(FCMhandle,0xFF);
switch (event)
{
case ADL_FCM_EVENT_FLOW_OPENNED: adl_fcmSwitchV24State(FCMhandle, ADL_FCM_V24_STATE_DATA); break;
case ADL_FCM_EVENT_V24_DATA_MODE : break;
case ADL_FCM_EVENT_V24_AT_MODE : break;
case ADL_FCM_EVENT_V24_DATA_MODE_EXT : break;
case ADL_FCM_EVENT_MEM_RELEASE: break;
case ADL_FCM_EVENT_FLOW_CLOSED: break;
}
return TRUE;
}
void FCMStart(u8 id)
{
FCMhandle = adl_fcmSubscribe(1,FCM_ctrl_Handler, FCM_data_Handler);
}
void appSimHandler (u8 Event)
{
switch (Event)
{
case ADL_SIM_STATE_FULL_INIT:
adl_atSendResponse (ADL_AT_RSP, "SIM Init Complete\r\n");
adl_tmrSubscribe (FALSE, 200 , ADL_TMR_TYPE_100MS, FCMStart); //wait for read options
break;
case ADL_SIM_STATE_PIN_WAIT:
adl_atSendResponse (ADL_AT_RSP, "\r\nADL_SIM_STATE_PIN_WAIT\r\n");
break;
case ADL_SIM_STATE_PIN_ERROR:
adl_atSendResponse (ADL_AT_RSP, "\r\nADL_SIM_STATE_PIN_ERROR\r\n");
break;
}
return;
}
void adl_main ( adl_InitType_e InitType )
{
adl_simSubscribe ( (adl_simHdlr_f) appSimHandler, NULL);
}
Shafeer
December 17, 2009, 5:11am
3
i cant get your code to work, will look into it thanks anyway
i have the following code, but i cannot write to it
#include "adl_global.h"
#include "wm_uart.h"
const u16 wm_apmCustomStackSize = 1024;
static psGItfCont_t uart_if;
static u32 uart1_hdl;
sUartSettings_t settings;
sUartLc_t line_coding;
void adl_main ( adl_InitType_e InitType )
{
line_coding.valid_fields = UART_LC_ALL;
line_coding.rate = (eUartRate_t)( UART_RATE_USER_DEF | 2400 );
line_coding.stop = UART_STOP_BIT_1;
line_coding.data = UART_DATALENGTH_8;
line_coding.parity = UART_PARITY_NONE;
//uART2 opened in null modem role/ synchronous read, write
settings.identity = "UART1";
settings.role = UART_ROLE_NM;
settings.capabilities = NULL;
settings.event_handlers = NULL;
settings.interface = &uart_if;
settings.line_coding=&line_coding;
uart1_hdl = adl_OpenDevice( DF_UART_CLID, &settings );
if ( !uart1_hdl )
{
// UART2 opening failed
return;
}
//uart_if.write( uart1_hdl, "Tx some bytes",13 ); <---this line does not work
}
Please help thanks?
MariMax
December 25, 2009, 9:42am
4
And if so to try:
uart_if->write( uart1_hdl, "Tx some bytes",13 );
Eraser
December 27, 2009, 9:07am
5
please look into ADL User Guide and you will find samples on how to use the UART ,
more you can set baudrate and the other parameters by at commands.