Arduino and SC16A Problem

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

Arduino and SC16A Problem

Postby ROBOTMAN » Sun Feb 21, 2010 3:40 am

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.
ROBOTMAN
Freshie
 
Posts: 5
Joined: Sun Feb 21, 2010 3:36 am

Re: Arduino and SC16A Problem

Postby sich » Mon Feb 22, 2010 2:17 pm

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.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Arduino and SC16A Problem

Postby ROBOTMAN » Mon Feb 22, 2010 3:17 pm

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.
ROBOTMAN
Freshie
 
Posts: 5
Joined: Sun Feb 21, 2010 3:36 am

Re: Arduino and SC16A Problem

Postby ober » Mon Feb 22, 2010 8:26 pm

What did you get at the computer? Any data shown? What is the data shown?
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: Arduino and SC16A Problem

Postby ROBOTMAN » Tue Feb 23, 2010 7:22 am

Yes data was shown it was mostly "A" and some other characters.
ROBOTMAN
Freshie
 
Posts: 5
Joined: Sun Feb 21, 2010 3:36 am

Re: Arduino and SC16A Problem

Postby sich » Tue Feb 23, 2010 4:15 pm

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.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Arduino and SC16A Problem

Postby ROBOTMAN » Wed Feb 24, 2010 1:29 pm

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.
ROBOTMAN
Freshie
 
Posts: 5
Joined: Sun Feb 21, 2010 3:36 am

Re: Arduino and SC16A Problem

Postby sich » Thu Feb 25, 2010 4:40 pm

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.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Arduino and SC16A Problem

Postby ROBOTMAN » Sun Feb 28, 2010 4:34 am

Yes it dose work when I connect it to the computer directly.
ROBOTMAN
Freshie
 
Posts: 5
Joined: Sun Feb 21, 2010 3:36 am

Re: Arduino and SC16A Problem

Postby ober » Mon Mar 01, 2010 11:51 am

Maybe post a photo of your hardware setup is a good idea as most of us cannot get the idea on the connection.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Next

Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 17 guests

cron