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

horse riding on 16*2 lcd with flex_lcd.c

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



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

horse riding on 16*2 lcd with flex_lcd.c
PostPosted: Sat Jan 28, 2012 1:59 pm     Reply with quote

Few day ago I found HI-TECH code. Its work 16*2 lcd. Its working as display on lcd like horse riding on 16*2 lcd. So I decide, I will convert on CCS C, those are as...
Code:

 /********************************************************
  Main Program
 *********************************************************/
void main()
{
   disable_interrupts(GLOBAL);

  // Initilize RAM Variables

   //Timer1 Init
 
   //ADC Init
    enable_interrupts(INT_TIMER1);
   enable_interrupts(GLOBAL);
   
   while (TRUE)
   {

 lcd_init();  // Always call this first.
 for(;;){
          for(ctr=0;ctr<17;ctr++){
      horse1();
      lcd_gotoxy(ctr,1);
      for(a=0;a<=3;a++) lcd_putc(a);
      lcd_gotoxy(ctr,2);
      for(a=4;a<=7;a++) lcd_putc(a);
      delay_ms(500);}

      horse2();
      lcd_gotoxy(ctr,2);
      for(a=0;a<=3;a++) lcd_putc(a);
      lcd_gotoxy(ctr,1);
      for(a=4;a<=7;a++) lcd_putc(a);
      delay_ms(500);
}

 
}

}

void horse1(void)
 {
 int i,s,adres=64;
 const byte karakter_[8][8]=
 {
 {(0b00000) ,(0b00000) ,(0b00000) ,(0b00000) ,(0b00000) ,(0b00111) ,(0b01111) ,(0b11110)},


 {(0b00000) ,(0b00000) ,(0b00000) ,(0b00000) ,(0b01110) ,(0b11111) ,(0b11111) ,(0b11111)},


 {(0b00000) ,(0b00000) ,(0b00000) ,(0b00000) ,(0b00111) ,(0b11111) ,(0b11111) ,(0b11111)},


 {(0b00000) ,(0b00010) ,(0b11111) ,(0b11111) ,(0b11111) ,(0b11011) ,(0b10011) ,(0b10000)},


 {(0b00000) ,(0b00000) ,(0b00000) ,(0b00000) ,(0b00001) ,(0b00001) ,(0b00001) ,(0b00000)},


 {(0b11111) ,(0b11111) ,(0b11011) ,(0b10010) ,(0b00001) ,(0b00001) ,(0b10001) ,(0b00000)},


 {(0b11111) ,(0b11111) ,(0b00001) ,(0b00001) ,(0b00001) ,(0b00001) ,(0b00000) ,(0b00000)},


 {(0b11000) ,(0b11100) ,(0b00100) ,(0b01000) ,(0b10000) ,(0b00000) ,(0b10000) ,(0b00000)},
 };

 for(i=0;i<=7;i++)
 {
 lcd_send_byte(0,adres);
 for(s=0;s<=7;s++) {
 lcd_send_byte(1,karakter_[i][s]);
 }
 adres=adres+8;
 }
 }





void horse2(void)
 {
 int i,s,adres=64;
 const byte karakter_[8][8]=
 {
 { (0b00000) ,(0b00000) ,(0b00000) ,(0b00111) ,(0b01111) ,(0b01110) ,(0b11100) ,(0b11000)},


 { (0b00000) ,(0b00000) ,(0b00000) ,(0b01111) ,(0b11111) ,(0b11111) ,(0b11111) ,(0b11111)},


 { (0b00000) ,(0b00000) ,(0b00000) ,(0b00011) ,(0b11111) ,(0b11111) ,(0b11111) ,(0b11111)},


 { (0b00000) ,(0b00001) ,(0b11111) ,(0b11111) ,(0b11111) ,(0b11011) ,(0b10011) ,(0b10000)},


 { (0b10011) ,(0b10011) ,(0b00010) ,(0b00010) ,(0b00100) ,(0b00000) ,(0b00000) ,(0b00000)},


 { (0b11111) ,(0b00111) ,(0b01110) ,(0b00110) ,(0b00001) ,(0b00000) ,(0b00000) ,(0b00000)},


 { (0b01111) ,(0b00111) ,(0b10011) ,(0b01111) ,(0b00000) ,(0b10000) ,(0b00000) ,(0b00000)},


 { (0b10000) ,(0b11000) ,(0b01100) ,(0b00100) ,(0b00010) ,(0b00001) ,(0b00000) ,(0b00000)},

};

 for(i=0;i<=7;i++)
 {
 lcd_send_byte(0,adres);
 for(s=0;s<=7;s++) {
 lcd_send_byte(1,karakter_[i][s]);
 }
 adres=adres+8;
 }
 }


Original code is here:
http://shahrulnizam.com/pic-lesson-custom-character-lcd/
_________________
sahu
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Mon Jan 30, 2012 10:56 am     Reply with quote

Code:
    lcd_gotoxy(ctr,1);
       for(a=0;a<=3;a++) lcd_putc(a);
       lcd_gotoxy(ctr,2);
       for(a=4;a<=7;a++) lcd_putc(a);
       delay_ms(500);}

Code:

lcd_gotoxy(ctr,1);
for(a=0;a<=3;a++) lcd_putc(a);
 

Use for 1st line 1 to 4, 5*7 matrix, &&
Code:

lcd_gotoxy(ctr,2);
for(a=4;a<=7;a++) lcd_putc(a);

use for 2nd line 1 to 4, 5*7 matrix, is right ????
But display give image 1st line, 1 to 8 & then come 2nd line 1 to 4, 5*7 matrix.
pl help me .....
_________________
sahu
temtronic



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

View user's profile Send private message

PostPosted: Mon Jan 30, 2012 11:38 am     Reply with quote

You don't show what LCD driver you're using or the actual LCD itself.

It could be a problem with the translation from the original program or a driver / LCD mismatch.

The link didn't work for me, so I can't comment further on the 'translation' from it and without knowing the make/model of the LCD as well as the driver info...,can't help there either.
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Mon Jan 30, 2012 1:22 pm     Reply with quote

temtronic wrote:
You don't show what LCD driver you're using or the actual LCD itself.

It could be a problem with the translation from the original program or a driver / LCD mismatch.

The link didn't work for me, so I can't comment further on the 'translation' from it and without knowing the make/model of the LCD as well as the driver info...,can't help there either.

I use flex_lcd.c.
If know any problem I can post here original code, but it is HI-TECH . Can I post here ?
_________________
sahu
temtronic



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

View user's profile Send private message

PostPosted: Mon Jan 30, 2012 1:55 pm     Reply with quote

Well there's nothing wrong with the flex_lcd driver..

Sounds like you've got the wrong addresses for the lines on your LCD unit. You'll have to read the datasheet for your LCD to see though.
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Tue Jan 31, 2012 10:02 am     Reply with quote

temtronic wrote:
Well there's nothing wrong with the flex_lcd driver..

Sounds like you've got the wrong addresses for the lines on your LCD unit. You'll have to read the datasheet for your LCD to see though.

Right now no need for datasheet for my LCD. Because right now I use Oshonsoft sim.
_________________
sahu
temtronic



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

View user's profile Send private message

PostPosted: Tue Jan 31, 2012 10:37 am     Reply with quote

Gee next time you ask a question tell us all, upfront, you're using a SIMULATOR !!!

That will really help!!
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Tue Jan 31, 2012 11:44 am     Reply with quote

temtronic wrote:
Gee next time you ask a question tell us all, upfront, you're using a SIMULATOR !!!

That will really help!!

ok sorry - sorry
Oshon Soft SIMULATOR
_________________
sahu
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Horse image
PostPosted: Wed Feb 01, 2012 5:06 am     Reply with quote

Quote:

The link didn't work for me, so I can't comment further on the 'translation' from it and without knowing the make/model of the LCD as well as the driver info...,can't help there either.


Link worked for me. It produces these two images of a horse on LCD. I do not propose to help with translation from Hi-Tec to a simulator.
Code:

horse1
                       
                     *
                  *****
                  *****
       ***    *** *****
  *** ***** ***** ** **
***** ***** ***** *  **
****  ***** ***** *   

      ***** ***** **   
      ***** ***** ***   
      ** **     *   *   
      *  *      *  *   
    *     *     * *     
    *     *     *       
    * *   *       *     
                       



horse2

                       
                      *
                  *****
  ***  ****    ** *****
 **** ***** ***** *****
 ***  ***** ***** ** **
***   ***** ***** *  **
**    ***** ***** *     

*  ** *****  **** *     
*  **   ***   *** **   
   *   ***  *  **  **   
   *    **   ****   *   
  *       *          * 
            *         *

Mike
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

Re: Horse image
PostPosted: Wed Feb 01, 2012 9:29 am     Reply with quote

My propose for translating it is, because I add it in rest of my code. Which is in ccs c.
_________________
sahu
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Simulators
PostPosted: Wed Feb 01, 2012 2:19 pm     Reply with quote

What the real experts on this forum are saying loud and clear is "SIMULATORS ARE A WASTE OF TIME". You will get more help when you use hardware. All simulators are flawed, there are enough problems to solve without getting into sorting out other issues.

Mike
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