Hello to all!
I've spend the last month trying to troubleshoot why my arduino board is not sending serial commands over RS232. The device is a card dispenser that uses RS232 to control it. I have a arduino Uno and a linksprit RS232 shield with a MAX3232 chip. Starting simple I'm just trying to code the Eject Front command shown below under command structure. The device receives ASCII codes. According to the device manual it reads:
Communication Protocol:
Baud rate(BPS): Can be set by controller(Default at 9600BPS)
Communicate Mode: Asynchronous communication
Transmit mode: Half duplex
Data frames structure: Start bit: 1bit
Data bit:8bits
A Check Bit: No
Stop Bit:1bit
Command Structure:
Eject Front command
15FC
: 0 2 H , Frame start
: 0 3 H , Frame end
: ? O ? O ? O ? O ? ,Block checkout
‘O’ : Means a character’s ASCII code
‘X’ : Means a character’s ASCII code
I've written the code below in HEX only because I'm confused on how to send the start and end frame in ASCII. Also because I listened to the communication between the device and PC and matched the HEX commands but the code send should be ASCII according to the manual.
#include <SoftwareSerial.h>
SoftwareSerial deviceSerial(6, 7); // RX, TX
void ejectFront();
void setup() {
Serial.begin(9600);
deviceSerial.begin(9600);
}
void loop() {
ejectFront();
}
void ejectFront() {
deviceSerial.write(0x02);
deviceSerial.write(0x31);
deviceSerial.write(0x35);
deviceSerial.write(0x46);
deviceSerial.write(0x43);
deviceSerial.write(0x30);
deviceSerial.write(0x03);
deviceSerial.write(0x30);
}
Thank you for taking your time to read this.