Pages: [1]   Go Down
Author Topic: How send a request to device?  (Read 471 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I have device IVTM-7N [1] and Arduino Duemilanove
How send a request from Arduino to device?

Request example: $ 0001 RR 0000 04 AD 0D
[Addr] = 0001, [Cmd] = RR, [DataAddr] = 0000, [DataLen] = 04, [ch] = AD

-------------------------------------
Code:
#include <NewSoftSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h>         //Used for string manipulations

char incoming_char=0;      //Will hold the incoming character from the Serial Port.

NewSoftSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

void setup()
{
  //Initialize serial ports for communication.
  Serial.begin(9600);
  cell.begin(9600);
 
  //Let's get started!
  Serial.println("Starting...");
  delay(500); // give the module some thinking time
  cell.println("$ 0001 RR 0000 04 AD 0D");
  delay(500); // give the module some thinking time
  cell.println("$ 0001 RR 0000 04 AD 0D");
}

void loop() {
  //If a character comes in from the cellular module...
  if(cell.available() >0)
  {
    incoming_char=cell.read();    //Get the character from the cellular serial port.
    Serial.print(incoming_char);  //Print the incoming character to the terminal.
  }
  //If a character is coming from the terminal to the Arduino...
  if(Serial.available() >0)
  {
    incoming_char=Serial.read();  //Get the character coming from the terminal
    cell.print(incoming_char);    //Send the character to the cellular module.
  }
}

This is not work(
-------------------------------------------------------

[1] http://translate.google.ru/translate?js=n&prev=_t&hl=ru&ie=UTF-8&layout=2&eotf=1&sl=ru&tl=en&u=http%3A%2F%2Fwww.eksis.ru%2Fosobennosti-primenenija-i-tipovye-reshenija%2Fprotokol-obmena-s-priborami-oao-praktik-nts-i-zao-eksis.html

[~800kb] http://viewkazan.ru/foto/20110317_002.jpg (RS-232 of device)
[~800kb] http://viewkazan.ru/foto/20110317_003.jpg (connect to Arduino)


* 20110317_001.jpg (767.99 KB, 2576x1936 - viewed 7 times.)
« Last Edit: March 17, 2011, 04:48:25 am by servantos » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48569
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That RS232 connector should tell you something about the device. Specifically, it is most likely NOT using TTL level voltages. You need a MAX232 chip in between. Soon. Like before you damage your Arduino, if you haven't already.
Logged

Pages: [1]   Go Up
Jump to: