Go Down

Topic: How send a request to device? (Read 516 times) previous topic - next topic


Mar 17, 2011, 10:36 am Last Edit: Mar 17, 2011, 10:48 am by servantos Reason: 1

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: [Select]

#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.
  //Let's get started!
  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)


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.

Go Up