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 CCS Technical Support

Matrix Orbital LCD - RS-232 control using 16F877A

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



Joined: 13 Aug 2007
Posts: 4

View user's profile Send private message

Matrix Orbital LCD - RS-232 control using 16F877A
PostPosted: Fri Nov 05, 2010 8:15 am     Reply with quote

I am trying to get a matrix Orbital GLC24064 LCD to work using a PIC 16F877A. I have the 232 jumpers in place on the back of the LCD and I'm using the CCS Embedded Serial Busses Prototyping Board with the RS-232 IC. My program is:
Code:

#include <16F877A.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT,PUT
#use delay (clock=10000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv = PIN_C7, FORCE_SW, INVERT)

void main() {

   while(TRUE)
   {

      printf("ABCDEFGHIJKLMNOPQRSTUVWXYZ");

   }
}

I have absolutly no response on the LCD and I was able to get the LCD to operate using the Matrix Orbital Graphics Display software.

If I insert the plug partially I get strange data repeatedly come out as; 'arrowfxtriangleffarrowfffffffarrowff' where arrow and triangle are actually arrows and triangles.

Thanks for any help that can be provided.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Nov 05, 2010 9:05 am     Reply with quote

First...get rid of the 'invert' option in the use rs232 setup as you ARE using the MAX232 chip.

Second..you should put in a delay, say 1 second in main before writing to the display, to be sure it gets initialised properly BEFORE you try jamming characters down it's throat....
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Nov 05, 2010 9:08 am     Reply with quote

If you have been playing with differents configurations options, do a Manual Override in order to restore
the module configuration in default settings.
If you set the Flow Control OFF, be aware that the module buffer will overflow without any warning,
because of this you can not do a continuous string transmition as shown in your code.
Re-check the Protocol Select Jumpers.

Code:

#include <16F877A.h>
#device ICD=TRUE
#use delay (clock=10000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv = PIN_C7)

void main() {
int j;
 
 delay_ms(500);
 printf("%xX",0xFE); // Clear screen 
 printf("%xH",0xFE); // Home position 
 
 for(j='A'; j<='Z'; j++)
     {printf("%c",j);}
 while(1);
}


Regards
andrewg



Joined: 17 Aug 2005
Posts: 316
Location: Perth, Western Australia

View user's profile Send private message Visit poster's website

PostPosted: Fri Nov 05, 2010 8:55 pm     Reply with quote

Always include ERRORS in your #use rs232!
_________________
Andrew
nutmegzzzz



Joined: 13 Aug 2007
Posts: 4

View user's profile Send private message

PostPosted: Mon Nov 08, 2010 8:20 am     Reply with quote

It works now thank you so much, however when I work with Humberto's code, I get;

feXfeHABCDEFGHIJKLMNOPQRSTUVWXYZ

and the code then fills the whole screen. I would like to clear the screen and sooner or later start choosing the coordinates that I want to write to rather then write the whole screen.

Again thanks so much!
nutmegzzzz



Joined: 13 Aug 2007
Posts: 4

View user's profile Send private message

PostPosted: Mon Nov 08, 2010 3:22 pm     Reply with quote

From my request at the Matrix Orbital forum, they suggested;

Quote:
You need to make sure that when you send the command 0xFE 0x58 (clear screen command) that you are sending only 2 bytes, and not a total of 4 bytes as you see in your display: 'fe58' which is 4 bytes.

Please check the printf format details of your compiler.


Previously they gave the code;

Quote:
// clear screen
printf("%x",0xFE);
printf("%x",0x58);

// go to home position
printf("%x",0xFE);
printf("%x",0x48);


I've tried various formats and I understand that I want to send '11111110' and '01011000' but I do not know how to do this and get the screen to actually clear. Any suggestions?
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Nov 08, 2010 3:41 pm     Reply with quote

Replace %x, with %c.
%x, sends the hex representation of the value given. %c, sends the 'raw' character.

Best Wishes
nutmegzzzz



Joined: 13 Aug 2007
Posts: 4

View user's profile Send private message

PostPosted: Mon Nov 08, 2010 4:27 pm     Reply with quote

That works perfectly, thank you for everyone's help, below is a simple code if anyone needs it in the future.

Code:
#include <16F877A.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT,PUT
#use delay (clock=10000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv = PIN_C7)

void main()
{
int j;
int x;

x=0;

//clear screen
delay_ms (300);
printf("%c",254);
printf("%c",88 );

//place cursor
printf("%c",254);
printf("%c",71);
printf("%c",3);   //place cursor at 3rd column over
printf("%c",5);   //place cursor at 5th row down

for(j='A'; j<='Z'; j++)
   {
      printf("%c",j);
      //delay_ms(10);
   }
}
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