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

sending serial data to 6 digit display

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



Joined: 19 Feb 2005
Posts: 11
Location: new york usa

View user's profile Send private message

sending serial data to 6 digit display
PostPosted: Sun Feb 18, 2007 12:34 pm     Reply with quote

I recently got a large six digit 7 segment led display from a company called siliconcraft. I have been working for 2 days trying to get it to work.
a VB6 program that works sends data out the serial port 96000 n81.

MSComm1.Output = Chr$(254) & Chr$(3) & "123456" & Chr$(255).

This will show "123456" on the display.
Using an 18f452 and the CCS proto board, I have tried using

printf("%c%c%s%c",254,3,"123456",255); but get no results.

I think the problem has to do with the string "123456". When I use hyper terminal to compare the data from the VB and C code they look the same except i only get "12345" . The other characters are control characters.
Any help would be greatly appreciated.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 1:49 pm     Reply with quote

It could be that the data is different, or it could be the inter-character
spacing that is different. (i.e., the time interval between transmission
of characters).

You need to capture the serial data and compare the characters
that are sent by the PIC or by VB6. You need a terminal program
that can display data in hex. Then you can see the control characters.

Or, to see the PIC's output, you can use sprintf() and then display
the buffer contents. The program below shows how to do this.
Here's the output:
Quote:

FE 03 31 32 33 34 35 36 FF 00 00 00 00 00 00 00 00 00 00 00


Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//=======================
void main(void)
{
int8 buffer[20];
int8 i;

sprintf(buffer, "%c%c%s%c",254,3,"123456",255);

for(i = 0; i < sizeof(buffer); i++)
    printf("%X ", buffer[i]);

while(1);
}


If you can't get a terminal program that will display the VB6 data in hex,
then you could write a PIC program to read the VB6 output (from Com1)
and then send it to the PC as Ascii Hex bytes (as shown in the program
above).

To test if the problem is caused by inter-character spacing, you could
modify the PIC program to send one character at a time and put a
100 ms delay between each character, as it's sent to the 7-segment
display. (Use 100ms for an initial test).
tkidder



Joined: 19 Feb 2005
Posts: 11
Location: new york usa

View user's profile Send private message

tkidder
PostPosted: Sun Feb 18, 2007 4:59 pm     Reply with quote

Intercharacter delay necessary, needed a min of 5ms.

Many Thanks for help
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