Page 1 of 2

Arduino and SC16A Problem

PostPosted: Sun Feb 21, 2010 3:40 am
by ROBOTMAN
I have come here as a last resort. I am attempting to control the sc16a with my arduino and the software serial library. I used this code.

#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3
byte data = 0;
byte data1 = 0;
byte data2 = 0;

SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
}

void loop()
{
mySerial.print( 65, BYTE );
mySerial.print( 65, BYTE );
mySerial.print( 0, BYTE);
mySerial.print( 60, BYTE);
}

Basically this sends the numbers 65, 25, 25, and 60 to pins 2 and 3 configured for serial. This appears to be the correct protocol but I would like that verified as well. My main question however is why this code will not work.

Re: Arduino and SC16A Problem

PostPosted: Mon Feb 22, 2010 2:17 pm
by sich
Is that your complete source code? Where's the main function? Sorry if I'm wrong coz i never use arduino before.

To verify the program, you can connect the UART connection to your computer by using USB to UART converter or through a max232 circuit, depending on your hardware setup. Then read the data send by your arduino.

Re: Arduino and SC16A Problem

PostPosted: Mon Feb 22, 2010 3:17 pm
by ROBOTMAN
Yes that is the complet code. I already checked that and all the data appears to be sent but there is something that is strange. The arduino appears to only transmit when I connect to it the way you described. It seems to refues to transmit until I connect to it in that way.

Re: Arduino and SC16A Problem

PostPosted: Mon Feb 22, 2010 8:26 pm
by ober
What did you get at the computer? Any data shown? What is the data shown?

Re: Arduino and SC16A Problem

PostPosted: Tue Feb 23, 2010 7:22 am
by ROBOTMAN
Yes data was shown it was mostly "A" and some other characters.

Re: Arduino and SC16A Problem

PostPosted: Tue Feb 23, 2010 4:15 pm
by sich
ROBOTMAN WROTE:I already checked that and all the data appears to be sent but there is something that is strange.

How do u verify that the data has been sent?

ROBOTMAN WROTE:The arduino appears to only transmit when I connect to it the way you described. It seems to refues to transmit until I connect to it in that way.

I don't get what u mean here...more explanation please.

Re: Arduino and SC16A Problem

PostPosted: Wed Feb 24, 2010 1:29 pm
by ROBOTMAN
I the sc16a patches the serial it receives through to a serial monitor. What I meant was that no data is transferred unless USB is connected to the sc16a.

Re: Arduino and SC16A Problem

PostPosted: Thu Feb 25, 2010 4:40 pm
by sich
ROBOTMAN WROTE:...no data is transferred unless USB is connected to the sc16a.

Can you verify the data without using SC16A? Just power on your arduino and connect the UART to ur PC. If that yields negative results, there's no point to test together with SC16A.

However, I'm still confuse about your connection and how you test it. Post some relevant photos maybe will help.

Re: Arduino and SC16A Problem

PostPosted: Sun Feb 28, 2010 4:34 am
by ROBOTMAN
Yes it dose work when I connect it to the computer directly.

Re: Arduino and SC16A Problem

PostPosted: Mon Mar 01, 2010 11:51 am
by ober
Maybe post a photo of your hardware setup is a good idea as most of us cannot get the idea on the connection.