0

first of all let me thank you all , you have been of great help. So, my problem is the next , i have note counter machine i need to read the data from the machine to the arduino , as bytes or ascii , just some readble data . The machine is connected on the arduino via 2 pins , tx and rx and the data i am getting is not readble and kind of wierd , and one more question do i need some kind of serial shiled or no ?Because right now it is connected with just 2 wires . Thank you

#include <AltSoftSerial.h>
// AltSoftSerial always uses these pins:
//
// Board Transmit Receive PWM Unusable
// ----- -------- ------- ------------
// Teensy 3.0 & 3.1 21 20 22
// Teensy 2.0 9 10 (none)
// Teensy++ 2.0 25 4 26, 27
// Arduino Uno 9 8 10
// Arduino Leonardo 5 13 (none)
// Arduino Mega 46 48 44, 45
// Wiring-S 5 6 4
// Sanguino 13 14 12
AltSoftSerial altSerial;
void setup() {
 Serial.begin(9600);
 while (!Serial) ; // wait for Arduino Serial Monitor to open
 Serial.println("AltSoftSerial Test Begin");
 altSerial.begin(9600);
}
byte rx_byte =0 ;
char text ;
char hex;
void loop() {
 if (altSerial.available()) {
 // get the byte from the software serial port
 rx_byte = altSerial.read();
 // send a byte to the software serial port
 //altSerial.println(text);
 Serial.print(rx_byte, HEX);
}
 //Serial.println("TUKA SUM");
 //text = altSerial.read();
 //hex=(text);
 //Serial.print(text); 
 //Serial.write(text);
 // Serial.println(text);
asked Nov 14, 2018 at 12:03
14
  • What is the code? And what is the weird output? Commented Nov 14, 2018 at 12:05
  • Please provide a link to the note counter you are using. Commented Nov 14, 2018 at 12:07
  • Why are you using soft serial and not 'hardware' serial? What is the output? And are you sure 9600 is the correct speed? Commented Nov 14, 2018 at 12:07
  • AltSoftSerial Test Begin 00FE0F00000000000000000000000000000140B50000000000000000009C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083000830000B4AFB400002F90008000007F0042000091000E700E2FF00000F001E00FE0080000000000007DFC00F0000000008000FF Commented Nov 14, 2018 at 12:08
  • This is what i am getting , and link is souqmega.com/product/nc3500-ma-value-counting-machine Commented Nov 14, 2018 at 12:10

1 Answer 1

0

The 9-pin port is designed for connecting to a printer. It uses the RS-232 protocol, not UART.

You cannot connect it directly to an Arduino - you must connect it via a MAX232 adaptor board.

Disconnect the cable immediately - the voltage levels of RS-232 are likely to do permanent damage to the Arduino.

answered Nov 14, 2018 at 12:51
3
  • Yeah i saw it somewhere , i disconeteced it , so in conclusion there is no way just two wires from serial cable to tx and rx on arduino ? Commented Nov 14, 2018 at 12:53
  • Nope. You need to transform the voltage levels from -10V/+10V to +5V/0V. Commented Nov 14, 2018 at 12:54
  • So without MAX232 adaptor board i can do the thing i want , Okey , thank you a lot . Commented Nov 14, 2018 at 12:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.