CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Trouble sending RS232 commands to a projector

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cap110874
Guest







Trouble sending RS232 commands to a projector
PostPosted: Thu Sep 03, 2009 7:57 am     Reply with quote

Hi

I am trying to send rs232 commands to turn a projector on and off.

If i test in a hyperterminal or similar I type
"~0000 1" and then hit returm on the keyboard.
This turns on the projector.
"~0000 2" and then hit returm on the keyboard.
This turns off the projector.
All ok from hyperterminal
but when i use me pic 18f2525 too generate nothing happens. Testing with hyperterminal i am getting the commands but the dont do anyrthing to the projector. Looks like the carriage return is not working but cant work out why.

Code being used is:
if (last == turnOn)
return;

fputc(0x0D, STREAM_UART); //c return
if (turnOn)
fprintf(STREAM_UART, "~0000 1");
else
fprintf(STREAM_UART, "~0000 2");

fputc(0x0D, STREAM_UART); //c return
last = turnOn;
}
break;
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Sep 03, 2009 8:25 am     Reply with quote

U may get an answer if you post your
compiler version
and a short example of your code ( WITH FUSES FOR SURE )
that JUST shows your communication setup

and no other stuff.
PS make sure it compiles w/o err before posting ok ?

BTW- what HARDWARE are you using to interface the PIC to said projector?


can you connect the pic via a nullmodem to HYPER term and SEE what you are sending ?

can u post a PDF or JPG of the schematic ?
cap 110874
Guest







output text issue
PostPosted: Thu Sep 03, 2009 8:36 am     Reply with quote

Quote:
U may get an answer if you post your
compiler version

Version 4.079

Quote:
and a short example of your code ( WITH FUSES FOR SURE )
that JUST shows your communication setup

I only posted this bit as this is the only part with the issue.
The code compiles and works properly, and using a hyperterminal sends the commands as I expect. But when the projector (Optoma hd82) receives the commands nothing happens.

I know this is almost certainly to do with the carriage return because if I use a serial program for windows like hyperterminal I can type the command to turn on ie ~0000 1 and then hit enter and the projector turns on. If I send the string from the hyper terminal ~0000 1 <CR> nothing happens, seems to only work when I hit return on the keyboard.

I as wanting to know if there were any other ways of sending the carriage return key via the code to simulate hitting the Return key. I'm currently sending putc 0x0D.


Thanks
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Sep 03, 2009 8:41 am     Reply with quote

Format strings
Code:
printf("\r\n");
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Thu Sep 03, 2009 11:18 am     Reply with quote

hello,

You should find out if your projector uses flow control...
(pins 1,4,6,7,8) on the DB9 Cable).
You can figure this out by making your own cable, using only pins
2,3, and 5..... null modem cable... as mentioned before.

I had a similar problem with a cellphone.

Also, check if hyperterminal is sending extra characters.

Use Siow instead of hyperterminal. (siow comes with the CCS compiler)

This is a basic solution... so simple, it gets overlooked often.

Hope this helps.

gabriel
_________________
CCS PCM 5.078 & CCS PCH 5.093
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Sep 03, 2009 3:25 pm     Reply with quote

Try sending commands from the PC using a macro vs. typing character by character. Maybe the projector needs spacing between characters to work or its UART buffer overflows. If you have a scope or simple logic analyzer you can see character spacing.

Also try changing your baud rate by +/- 2%. Maybe the PIC or projector baud rate clock is a little off.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group