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

T6963C moving Data line from PORTB to PORTD problem!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

T6963C moving Data line from PORTB to PORTD problem!
PostPosted: Sun Dec 28, 2014 10:26 am     Reply with quote

Hello,
I am still can't solve this problem. Please help me. When i am using PORTD (changed everything in T6963c library for using PORTD). When system turn on on GLCD shows irregular black spots. What is the problem.

Sorry for my english.

I am thinking:

1-) Expecting a #FUSES command
2-) Expecting make passive a PORTD feature
3-) Expecting using pull-up or pull-down resistor for PORTD

CODE:
Code:
#include <18F452.h>
#include <T6963C.c>
#include <Grafikler.h>
#include <Animasyonlar.h>
#include <stdlib.h>

#FUSES HS
#use delay(clock=20000000)

int deger;

char deger_str[];

void main()

   setup_psp(TRUE);        // PSP birimi devre dışı
   setup_timer_1(T1_DISABLED);     // T1 zamanlayıcısı devre dışı
   setup_timer_2(T2_DISABLED,0,1); // T2 zamanlayıcısı devre dışı
   setup_adc_ports(NO_ANALOGS);    // ANALOG giriş yok
   setup_adc(ADC_OFF);             // ADC birimi devre dışı
   setup_CCP1(FALSE);            // CCP1 birimi devre dışı
   setup_CCP2(FALSE);            // CCP2 birimi devre dışı
   
   

   ekran_temizle(); 
   Resim_goster(LoadMomentIndicator,240,128,0,0); // "LoadMomentIndicator" ekrana basılıyor
   delay_ms(100);
   
   ekran_temizle(); 
   Resim_goster(MesaElectronics,240,128,0,0); // "MesaElectronics" ekrana basılıyor 
   delay_ms(100);
   for(int a=0;a<=126;a=a+14)
        {
          glcd_box(51+a,91,62+a,108,1); // İçi dolu dikdörtgen
          delay_ms(10);
        }
   
   ekran_temizle();
   Resim_goster(AnaGosterge,240,128,0,0); // "AnaGosterge" ekrana basılıyor

   while(true)
   {
   deger = 4;
   itoa(deger,10,deger_str);//float to string işlemi gerçekleştiriliyor
   glcd_box(66,68,110,87,0);
   glcd_text57(68,72,deger_str,2,1);//voltaj_str değeri ekrana yazdırılıyor
   delay_ms(500);
   }
   
   



T6963C.c:
Code:
/////////////////////////////////////////////////////////////////////////
////    T6963C.c     -      T6963C driver                            ////
////   Not for comercial Use                                         ////
////      Driver by treitmey Graphic functions and Resolution Select ////   
////                                    by mcdoganay([email protected]) ////
////                                                                 ////
//// This file contains drivers for using a Tosiba T6963C controller ////
//// in parallel/8080(intel) mode.  The T6963C is 256 pixels across  ////
////  and 256 pixels down. The driver treats the upper left pixel 0,0 ////
////                                                                 ////
////  Connections are as follows:                                    ////
////  /WR - - C4                                                     ////
////  /RD - - C5                                                     ////
////  C//D- - C6                                                     ////
////  /RST- - C7                                                     ////
////  DATA0-7 PORTD0-7                                               ////
////  LCD's FS is tied low (FS = 0 is 8x8 font)                      ////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////

// 256 x 256 in the 8x8 font mode means that 30 characters across by
// 32 rows of characters may be displayed

#define set_tris_lcd(x) set_tris_d(x) // Data hattı hangi portta ise o tanımlanacak örneğin "set_tris_c(x)"
#define LCDColorBlack 0b1
#define LCDColorWhite 0b0

#use fast_io(D) // Yukarıda tanımlanan data portu girilecek örneğin fast_io(C)

const int16 TextHome = 3968;
const int8  TextArea = 30; // how many bytes before a new line
const int16 GraphicsHome = 0;
const int8  GraphicsArea = 30; // how many bytes before a new line

const int8 AutoModeWrite = 0xB0;
const int8 AutoModeRead  = 0xB1;
const int8 AutoModeReset = 0xB2;

const int8 LCDModeSet  = 0x80;   // send this OR'd with the following
const int8 LCDMode_OR  = 0b0000;
const int8 LCDMode_XOR = 0b0001;
const int8 LCDMode_AND = 0b0010;
const int8 LCDMode_TA  = 0b0100; // TEXT ATTRIBUTE mode.
const int8 LCDMode_RAM = 0b1000; // 1=CG RAM, 0=internal CG ROM

const int8 LCDSetCursorPtr  = 0x21;  // cursor address
const int8 LCDSetCursorSize = 0xA0;  // 1 line cursor

const int8 LCDDispMode = 0x90;   // send this OR'd with the following
const int8 LCDDisp_BLK = 0b0001;
const int8 LCDDisp_CUR = 0b0010;
const int8 LCDDisp_TXT = 0b0100;
const int8 LCDDisp_GRH = 0b1000;

const int8 LCDBitSet   = 0xF8;
const int8 LCDBitReset = 0xF0;
const int8 LCDBit0 = 0b000;
const int8 LCDBit1 = 0b001;
const int8 LCDBit2 = 0b010;
const int8 LCDBit3 = 0b011;
const int8 LCDBit4 = 0b100;
const int8 LCDBit5 = 0b101;
const int8 LCDBit6 = 0b110;
const int8 LCDBit7 = 0b111;

const int8 LCDSetPtr = 0xE0;


struct lcd_pin_def
{
   BOOLEAN cd;       // Kontrol hattının 6. pini Command/Data bar bağlı (1=command 0=data) 
   BOOLEAN w_bar;    // Kontrol hattının 1. pini Write bar bağlı (düşükte aktif)
   BOOLEAN r_bar;    // Kontrol hattının 5. pini Read bar bağlı (düşükte aktif)
   BOOLEAN unused1;  // Kontrol hattının 0. pini
   BOOLEAN unused2;  // Kontrol hattının 2. pini
   BOOLEAN reset_bar;// Kontrol hattının 7. pini Reset bağlı (düşükte aktif)
   BOOLEAN unused3;  // Kontrol hattının 3. pini
   BOOLEAN unused4;  // Kontrol hattının 4. pini
};
struct lcd_pin_def  LCD;

  #byte LCD = 0xf82        // Kontrol portunun işlemcideki adresi (18f452 için B port adresi 0xf81)
  #byte LCD_Data = 0xf83   // Data portunun işlemcideki adresi (18f452 için D port adresi 0xf83)
 
int   glcd_ReadByte(void);
void  glcd_WriteByte(int1 cd, int data);
void  glcd_WriteByteAuto(int data);
void  glcd_WriteCmd2(int16 data, int cmd);
void  glcd_WriteCmd1(int data, int cmd);
void  glcd_gotoxy(int x, int y, int1 text);
/////////////////////////////////////////////////////////////////////////
//// Defines a 5x7 font
/////////////////////////////////////////////////////////////////////////
const int8 FONT[51][5] ={0x00, 0x00, 0x00, 0x00, 0x00, // SPACE
                         0x00, 0x00, 0x5F, 0x00, 0x00, // !
                         0x00, 0x03, 0x00, 0x03, 0x00, // "
                         0x14, 0x3E, 0x14, 0x3E, 0x14, // #
                         0x24, 0x2A, 0x7F, 0x2A, 0x12, // $
                         0x43, 0x33, 0x08, 0x66, 0x61, // %
                         0x36, 0x49, 0x55, 0x22, 0x50, // &
                         0x00, 0x05, 0x03, 0x00, 0x00, // '
                         0x00, 0x1C, 0x22, 0x41, 0x00, // (
                         0x00, 0x41, 0x22, 0x1C, 0x00, // )
                         0x14, 0x08, 0x3E, 0x08, 0x14, // *
                         0x08, 0x08, 0x3E, 0x08, 0x08, // +
                         0x00, 0x50, 0x30, 0x00, 0x00, // ,
                         0x08, 0x08, 0x08, 0x08, 0x08, // -
                         0x00, 0x60, 0x60, 0x00, 0x00, // .
                         0x20, 0x10, 0x08, 0x04, 0x02, // /
                         0x3E, 0x51, 0x49, 0x45, 0x3E, // 0
                         0x00, 0x04, 0x02, 0x7F, 0x00, // 1
                         0x42, 0x61, 0x51, 0x49, 0x46, // 2
                         0x22, 0x41, 0x49, 0x49, 0x36, // 3
                         0x18, 0x14, 0x12, 0x7F, 0x10, // 4
                         0x27, 0x45, 0x45, 0x45, 0x39, // 5
                         0x3E, 0x49, 0x49, 0x49, 0x32, // 6
                         0x01, 0x01, 0x71, 0x09, 0x07, // 7
                         0x36, 0x49, 0x49, 0x49, 0x36, // 8
                         0x26, 0x49, 0x49, 0x49, 0x3E, // 9
                         0x00, 0x36, 0x36, 0x00, 0x00, // :
                         0x00, 0x56, 0x36, 0x00, 0x00, // ;
                         0x08, 0x14, 0x22, 0x41, 0x00, // <
                         0x14, 0x14, 0x14, 0x14, 0x14, // =
                         0x00, 0x41, 0x22, 0x14, 0x08, // >
                         0x02, 0x01, 0x51, 0x09, 0x06, // ?
                         0x3E, 0x41, 0x59, 0x55, 0x5E, // @
                         0x7E, 0x09, 0x09, 0x09, 0x7E, // A
                         0x7F, 0x49, 0x49, 0x49, 0x36, // B
                         0x3E, 0x41, 0x41, 0x41, 0x22, // C
                         0x7F, 0x41, 0x41, 0x41, 0x3E, // D
                         0x7F, 0x49, 0x49, 0x49, 0x41, // E
                         0x7F, 0x09, 0x09, 0x09, 0x01, // F
                         0x3E, 0x41, 0x41, 0x49, 0x3A, // G
                         0x7F, 0x08, 0x08, 0x08, 0x7F, // H
                         0x00, 0x41, 0x7F, 0x41, 0x00, // I
                         0x30, 0x40, 0x40, 0x40, 0x3F, // J
                         0x7F, 0x08, 0x14, 0x22, 0x41, // K
                         0x7F, 0x40, 0x40, 0x40, 0x40, // L
                         0x7F, 0x02, 0x0C, 0x02, 0x7F, // M
                         0x7F, 0x02, 0x04, 0x08, 0x7F, // N
                         0x3E, 0x41, 0x41, 0x41, 0x3E, // O
                         0x7F, 0x09, 0x09, 0x09, 0x06, // P
                         0x1E, 0x21, 0x21, 0x21, 0x5E, // Q
                         0x7F, 0x09, 0x09, 0x09, 0x76};// R

const int8 FONT2[44][5]={0x26, 0x49, 0x49, 0x49, 0x32, // S
                         0x01, 0x01, 0x7F, 0x01, 0x01, // T
                         0x3F, 0x40, 0x40, 0x40, 0x3F, // U
                         0x1F, 0x20, 0x40, 0x20, 0x1F, // V
                         0x7F, 0x20, 0x10, 0x20, 0x7F, // W
                         0x41, 0x22, 0x1C, 0x22, 0x41, // X
                         0x07, 0x08, 0x70, 0x08, 0x07, // Y
                         0x61, 0x51, 0x49, 0x45, 0x43, // Z
                         0x00, 0x7F, 0x41, 0x00, 0x00, // [
                         0x02, 0x04, 0x08, 0x10, 0x20, // \
                         0x00, 0x00, 0x41, 0x7F, 0x00, // ]
                         0x04, 0x02, 0x01, 0x02, 0x04, // ^
                         0x40, 0x40, 0x40, 0x40, 0x40, // _
                         0x00, 0x01, 0x02, 0x04, 0x00, // `
                         0x20, 0x54, 0x54, 0x54, 0x78, // a
                         0x7F, 0x44, 0x44, 0x44, 0x38, // b
                         0x38, 0x44, 0x44, 0x44, 0x44, // c
                         0x38, 0x44, 0x44, 0x44, 0x7F, // d
                         0x38, 0x54, 0x54, 0x54, 0x18, // e
                         0x04, 0x04, 0x7E, 0x05, 0x05, // f
                         0x08, 0x54, 0x54, 0x54, 0x3C, // g
                         0x7F, 0x08, 0x04, 0x04, 0x78, // h
                         0x00, 0x44, 0x7D, 0x40, 0x00, // i
                         0x20, 0x40, 0x44, 0x3D, 0x00, // j
                         0x7F, 0x10, 0x28, 0x44, 0x00, // k
                         0x00, 0x41, 0x7F, 0x40, 0x00, // l
                         0x7C, 0x04, 0x78, 0x04, 0x78, // m
                         0x7C, 0x08, 0x04, 0x04, 0x78, // n
                         0x38, 0x44, 0x44, 0x44, 0x38, // o
                         0x7C, 0x14, 0x14, 0x14, 0x08, // p
                         0x08, 0x14, 0x14, 0x14, 0x7C, // q
                         0x00, 0x7C, 0x08, 0x04, 0x04, // r
                         0x48, 0x54, 0x54, 0x54, 0x20, // s
                         0x04, 0x04, 0x3F, 0x44, 0x44, // t
                         0x3C, 0x40, 0x40, 0x20, 0x7C, // u
                         0x1C, 0x20, 0x40, 0x20, 0x1C, // v
                         0x3C, 0x40, 0x30, 0x40, 0x3C, // w
                         0x44, 0x28, 0x10, 0x28, 0x44, // x
                         0x0C, 0x50, 0x50, 0x50, 0x3C, // y
                         0x44, 0x64, 0x54, 0x4C, 0x44, // z
                         0x00, 0x08, 0x36, 0x41, 0x41, // {
                         0x00, 0x00, 0x7F, 0x00, 0x00, // |
                         0x41, 0x41, 0x36, 0x08, 0x00, // }
                         0x02, 0x01, 0x02, 0x04, 0x02};// ~
/////////////////////////////////////////////////////////////////////////

#inline
void glcd_init(unsigned int16 res_x, unsigned int16 res_y) {
   
  int16 counter;
 
  set_tris_C(0b00011000);  // Kontrol portunun yönlendirilmesi
  set_tris_lcd(0xff);      // Data portunun yönlendirilmesi

  LCD.w_bar = 1;      // INITIAL STATES OF CONTROL PINS
  LCD.r_bar = 1;      //
  LCD.cd = 1;         // command

  LCD.reset_bar = 0;  // perform a reset
  LCD.reset_bar = 1;  // run

  // Set up the graphics and text areas
  glcd_WriteCmd2(TextHome, 0x40);
  glcd_WriteCmd2(TextArea, 0x41);
  glcd_WriteCmd2(GraphicsHome, 0x42);
  glcd_WriteCmd2(GraphicsArea, 0x43);

  // set address to 0
  glcd_WriteCmd2(0x0000, 0x24);
  glcd_WriteCmd2(0x0000, 0x24);

  // Clear all RAM of LCD (8k)
  glcd_WriteByte(1, AutoModeWrite);
  for (counter = 0; counter < 0x1fff; counter++)
  {
    glcd_WriteByteAuto(0);    // fill everything with zeros
  }
  glcd_WriteByte(1, AutoModeReset);
}

void glcd_WriteByte(int1 cd, int data)
{
    int status = 0, temp = 0;
    set_tris_lcd(0xff);
    LCD.w_bar = 1;
    LCD.r_bar= 1;
    LCD.cd = 1;//defaults

    while (status != 0x03) {  // is LCD busy?
       LCD.r_bar= 0;
       temp = LCD_Data;
       LCD.r_bar = 1;
       status = temp & 0x03;
    }

    set_tris_lcd(0x00);    // All outputs
    LCD.cd = cd;           // Command/Data bar
    LCD_Data = data;
    LCD.r_bar = 1;         // not read
    LCD.w_bar = 0;         // write
    LCD.w_bar = 1;         // release
}


void glcd_WriteByteAuto(int data)
{
   int status = 0, temp = 0; // status bits ARE DIFFERENT BITS THAN NORMAL
   set_tris_lcd(0xff);
   LCD.w_bar = 1;
   LCD.r_bar = 1;
   LCD.cd = 1; // defaults

   while (status != 0x08) {  // is LCD busy?
     LCD.r_bar = 0;
     temp = LCD_Data;
     LCD.r_bar = 1;
     status = temp & 0x08;
   }

   set_tris_lcd(0x00);     // All outputs
   LCD.cd = 0;             // This is always data, cd=0
   LCD_Data = data;        // Put data on data bus
   LCD.w_bar = 0;          // write
   LCD.w_bar = 1;          // release
}

void glcd_WriteCmd1(int data, int cmd)
{
  glcd_WriteByte(0, data);
  glcd_WriteByte(1, cmd);
}

void glcd_WriteCmd2(int16 data, int cmd)
{
  glcd_WriteByte(0, data & 0xff);
  glcd_WriteByte(0, data>>8);
  glcd_WriteByte(1, cmd);
}

int glcd_ReadByte(void)
{
  int data = 0, status = 0, temp = 0;
  set_tris_lcd(0xff);
  LCD.w_bar = 1;
  LCD.r_bar = 1;
  LCD.cd = 1;  // defaults

  #asm nop #endasm

  while (status != 0x03) {  // is LCD busy?
    LCD.r_bar = 0;
    temp = LCD_Data;
    LCD.r_bar = 1;
    status = temp & 0x03;
  }

  LCD.cd = 0;          // Command/Data bar
  LCD.r_bar = 0;        // read
  /////////////////////////////////////////////////////////
  #asm nop #endasm    // THIS PAUSE IS VERY NESSESARY !!!//
  /////////////////////////////////////////////////////////
  data = LCD_Data;
  LCD.r_bar = 1;
  LCD.cd = 1;
  return data;        // Return the read data
}

void glcd_putc(char c) {
   glcd_WriteCmd1(c - 0x20, 0xc0);
}

void glcd_gotoxy(int x, int y, int1 text) { // sets memory location to screen location x, y
   // location 1,1 is upper left corner;  text = 1 (text area), text = 0 (graphics area)
   int16 location, home;
   int line;

   if (text==0) {
      home = GraphicsHome;
      line = GraphicsArea;
   } else {
      home = TextHome;
      line = TextArea;
   }

   location = home + (((int16)y) * line) + x;
   glcd_WriteCmd2(location, 0x24);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// Purpose:       Clears LCD RAM
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
void glcd_clr(int16 location,int16 size)
{
  ////fprintf(DEBUG,"loc=%lu  size=%lu\n\r",location,size);
  // look very simular to the init,... doesn't it. : )
  glcd_WriteCmd2(location,LCDSetPtr);
  glcd_WriteCmd1(1,AutoModeWrite);
  for (;size;size--)
  {
    glcd_WriteByteAuto(0x00);//clear ram
  }
  glcd_WriteCmd1(1,AutoModeReset);
}

/////////////////////////////////////////
// Graphics Controller by mcdoganay (c)2010
//    [email protected]
//       Not for comercial use
/////////////////////////////////////////

unsigned int8 i;  //General Purpouse variable

// glcd_pixel(x,y,c) sets pixel x,y with c color
void glcd_pixel(unsigned int8 x, unsigned int8 y, int1 c){
   unsigned int8 x_H;
   unsigned int8 x_L=0;
   x_H = (x / 8);//6x8 karaktere göre ayarlandı
   x_L = 7 - (x - 8*x_H);//6x8 karaktere göre ayarlandı
   glcd_gotoxy(x_H,y,0);    //Bug fixed, thanks to etiedon
   if(c){
      glcd_WriteCmd1(1,(LCDBitSet|x_L));
   } else {
      glcd_WriteCmd1(1,(LCDBitReset|x_L));
   }
}

// glcd_pixel8(x,y,px8) sets 8 pixels in line.
void glcd_pixel8(unsigned int8 x, unsigned int8 y, int8 pixel8){
   unsigned int8 x_H;
   x_H = (x / 8); //6x8 karaktere göre ayarlandı
   glcd_gotoxy(x_H,y,0);
   glcd_WriteCmd1(pixel8,0xc0);
}

// glcd_line(x0,y0, x1,y1, c) puts line from (x0, y0) to (x1, y1) with c color
#separate
void glcd_line(int16 x1, int16 y1, int16 x2, int16 y2, int kalilik, int1 color)
{
   
   int16        dy, dx;
   signed int8  addx=1, addy=1;
   signed int16 P, diff;

   int16 i=0;
   int8 j = 0;
   
   dx = abs((signed int16)(x2 - x1));
   dy = abs((signed int16)(y2 - y1));


   if(x1 > x2)
      addx = -1;
   if(y1 > y2)
      addy = -1;

   if(dx >= dy)
   {
      dy *= 2;
      P = dy - dx;
      diff = P - dx;

      for(; i<=dx; ++i)
      {

         glcd_pixel(x1 + j, y1, color);

         if(P < 0)
         {
            P  += dy;
            x1 += addx;
         }
         else
         {
            P  += diff;
            x1 += addx;
            y1 += addy;
         }
      }
   }
   else
   {
      dx *= 2;
      P = dx - dy;
      diff = P - dy;

      for(; i<=dy; ++i)
      {

         glcd_pixel(x1, y1 + j, color);

         if(P < 0)
         {
            P  += dx;
            y1 += addy;
         }
         else
         {
            P  += diff;
            x1 += addx;
            y1 += addy;
         }
      }
   }
   
}


// glcd_square(x0,y0,x1,y1, c) sets square
void glcd_square( unsigned int8 x0, unsigned int8 y0,
                  unsigned int8 x1, unsigned int8 y1 , int1 c){
   glcd_line(x0,y0, x1,y0,1, c);
   glcd_line(x1,y0, x1,y1, 1,c);
   glcd_line(x0,y1, x1,y1, 1,c);
   glcd_line(x0,y0, x0,y1, 1, c);
}

// glcd_box(x0,y0,x1,y1, c)
void glcd_box( unsigned int8 x0, unsigned int8 y0,
               unsigned int8 x1, unsigned int8 y1 , int1 c){
   unsigned int8 x;
   unsigned int8 y;
   for(y=y0; y<=y1;y++){
      for(x=x0; x<=x1;x++){
         if((!(x%8)) && ((x1-x)>8)){
            glcd_pixel8(x,y,0xFF*c);  //Same time to write 8 pixel
            x +=7 ;
         } else {
            glcd_pixel(x,y,c);
         }
      }
   }
}

/////////////////////////////////////////////////////////////////////////
// Purpose:       Draw a circle on a graphic LCD
// Inputs:        (x,y) - the center of the circle
//                radius - the radius of the circle
//                fill - YES or NO
//                color - ON or OFF
/////////////////////////////////////////////////////////////////////////

void glcd_circle(int16 x, int16 y, int16 radius, int1 fill, int1 color)

{
   #ifdef LARGE_LCD
   signed int16 a, b, P;
   #else
   signed int8  a, b, P;
   #endif

   a = 0;
   b = radius;
   P = 1 - radius;

   do
   {
      if(fill)
      {
         glcd_line(x-a, y+b, x+a, y+b, 1, color);
         glcd_line(x-a, y-b, x+a, y-b, 1, color);
         glcd_line(x-b, y+a, x+b, y+a, 1, color);
         glcd_line(x-b, y-a, x+b, y-a, 1, color);
      }
      else
      {
         glcd_pixel(a+x, b+y, color);
         glcd_pixel(b+x, a+y, color);
         glcd_pixel(x-a, b+y, color);
         glcd_pixel(x-b, a+y, color);
         glcd_pixel(b+x, y-a, color);
         glcd_pixel(a+x, y-b, color);
         glcd_pixel(x-a, y-b, color);
         glcd_pixel(x-b, y-a, color);
      }

      if(P < 0)
         P += 3 + 2 * a++;
      else
         P += 5 + 2 * (a++ - b--);
    } while(a <= b);
}

//glcd_image8 (*Pic, x, y, size_x, size_y)
void glcd_image8(int8 *pic_px, unsigned int8 x, unsigned int8 y,
                 unsigned int8 size_x, unsigned int8 size_y){
   
   unsigned int16 px_y;
   unsigned int16 px_x;
   unsigned int16 px=0;
   
   for(px_y=y; px_y<(y+size_y); px_y++){
      for(px_x=x; px_x<(x+size_x); px_x+=8) //6x8 karaktere göre ayarlandı
      {
         glcd_pixel8(px_x, px_y, *(!pic_px+px));
         px+=1;
      }
   }
}
void glcd_text57(int16 x, int16 y, char* textptr, int8 size, int1 color)
{
   int8 j, k, l, m;                       // Loop counters
   int8 pixelData[5];                     // Stores character data

   for(; *textptr != '\0'; ++textptr, ++x)// Loop through the passed string
   {
      if(*textptr < 'S') // Checks if the letter is in the first font array
         memcpy(pixelData, FONT[*textptr - ' '], 5);
      else if(*textptr <= '~') // Check if the letter is in the second font array
         memcpy(pixelData, FONT2[*textptr - 'S'], 5);
      else
         memcpy(pixelData, FONT[0], 5);   // Default to space

      // Handles newline and carriage returns
      switch(*textptr)
      {
         case '\n':
            y += 7*size + 1;
            continue;
         case '\r':
            x = 0;
            continue;
      }

      if(x+5*size >= 240)          // Performs character wrapping
      {
         x = 0;                           // Set x at far left position
         y += 7*size + 1;                 // Set y at next position down
      }
      for(j=0; j<5; ++j, x+=size)         // Loop through character byte data
      {
         for(k=0; k < 7; ++k)             // Loop through the vertical pixels
         {
            if(bit_test(pixelData[j], k)) // Check if the pixel should be set
            {
               for(l=0; l < size; ++l)    // These two loops change the
               {                          // character's size
                  for(m=0; m < size; ++m)
                  {
                     glcd_pixel(x+m, y+k*size+l, color); // Draws the pixel
                  }
               }
            }
         }
      }
   }
}

_________________
M.Emir SADE
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Dec 28, 2014 11:24 am     Reply with quote

Quote:
1-) Expecting a #FUSES command
2-) Expecting make passive a PORTD feature
3-) Expecting using pull-up or pull-down resistor for PORTD

No. It is "no storage allocated for output string from itoa" in the code below:
Quote:
char deger_str[];

itoa(deger,10,deger_str);
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Sun Dec 28, 2014 11:26 am     Reply with quote

i changed like this char deger_str[10];
_________________
M.Emir SADE
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 29, 2014 12:44 pm     Reply with quote

Post a link to the website for your GLCD.
temtronic



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

View user's profile Send private message

PostPosted: Mon Dec 29, 2014 2:22 pm     Reply with quote

could be a simple solution...

you need a 'delay_ms(500)' in main before doing an lcd_init(); to allow most LCD modules time to 'stabilize' before the PIC tries to access them.

or

it could be a power supply problem, not enough current capacity at 5 volts to properly power the GLCD module.


jay
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 4:33 am     Reply with quote

my GLCD is Newhaven NHD-240128WG-ATFH-VZ#

http://www.newhavendisplay.com/specs/NHD-240128WG-ATFH-VZ.pdf
_________________
M.Emir SADE
temtronic



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

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 6:18 am     Reply with quote

hmm....

from your code...
first line in main()
...
setup_psp(TRUE); // PSP birimi devre dışı
...

The Parallel Slave Port is on PORTD so you do NOT want to enable it(true).

has to be (false) to disable the peripheral.


hth
jay
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 6:30 am     Reply with quote

temtronic wrote:
hmm....

from your code...
first line in main()
...
setup_psp(TRUE); // PSP birimi devre dışı
...

The Parallel Slave Port is on PORTD so you do NOT want to enable it(true).

has to be (false) to disable the peripheral.


hth
jay


i also tried with "setup_psp(FALSE);" but didnt work again. I ordered another model GLCD. And i am waiting it. I will reply again last status
_________________
M.Emir SADE
temtronic



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

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 6:35 am     Reply with quote

ok... back to basics...

does a simple 1Hz LED program work ?

This will confirm PIC is good, xtal is correct, programmer downloads properly.


Jay
temtronic



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

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 6:37 am     Reply with quote

hmm.. another question

Did you have it working on PORT B at all THEN change to PORT D?

If possible, I'd start with the 'default' of using PORT B.

Jay
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 6:49 am     Reply with quote

temtronic wrote:
hmm.. another question

Did you have it working on PORT B at all THEN change to PORT D?

If possible, I'd start with the 'default' of using PORT B.

Jay


My code working very well with PortB. When i change the T6963C library about data port changing commands. System didn't work.

Note: My codes working very well with portD on PROTEUS ISIS***
I can't understand the "what is problem?"
_________________
M.Emir SADE
temtronic



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

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 8:11 am     Reply with quote

ARRRGH.... ISIS !!!

When posting you MUST tell us if you're using REAL HARDWARE or defective simulator called ISIS/Proteus....

No wonder it 'doesn't work', it isn't REAL hardware.

ISIS.Proteus is KNOWN to NOT work. It is FULL of bugs, errors, faulty DRCs.

WHEN you get REAL hardware, then I can help.

I am not going to fix ISIS, life is way too short.

Jay
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 12:21 pm     Reply with quote

temtronic wrote:
ARRRGH.... ISIS !!!

When posting you MUST tell us if you're using REAL HARDWARE or defective simulator called ISIS/Proteus....

No wonder it 'doesn't work', it isn't REAL hardware.

ISIS.Proteus is KNOWN to NOT work. It is FULL of bugs, errors, faulty DRCs.

WHEN you get REAL hardware, then I can help.

I am not going to fix ISIS, life is way too short.

Jay


temtronic i am not a liar. i said my codes working in ISIS and don't working in REAL HARDWARE. and AGAIN i am NOT A LIAR. your experiences is not enough for this problem. I understand it. Thank you !
_________________
M.Emir SADE
temtronic



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

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 1:16 pm     Reply with quote

Ok, you have to understand that just because 'it works' in ISIS does not mean it will work with real hardware. A project will 'work' in ISIS without caps on the xtal, MCLR properly hooked up,etc.
Based on hundreds of posts I've read ,when anyone says ISIS, I usually assume they're 'working' within ISIS, not real hardware.

Since you say that the hardware worked fine using PORT B. then there are 3 things that will not allow the GLCD to function on PORT D.
1) bad PIC. easy to confirm, simply do the 1Hz LED test on each I/O pin.
Also, go back to using PORTB,see if it still works. If not, could be a bad GLCD as it did work...

2)bad setup code,. as I pointed out any peripherals used by PORT D must be disabled. Typically that includes PSP, ADC ,CCP, UARTs,SPI, etc. I don't use the 452,best to check the datasheet.uC and CCS defaults are not digital I/O to the pins.

3) incorrect pin assignments for the GLCD. perhaps in modifying the driver(hopefully a copy, not the original), one PORTB assignment wasn't remapped to PORTD.This will cause 'garbage' to be displayed.

To avoid any confusion... can you please confirm that the 'PORTB version' of your program does work with real hardware?

hth
jay


Since you're getting black squares, here and there, it really could be either a bad PIC or a minor coding issue.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 01, 2015 6:39 pm     Reply with quote

Post a schematic of your connections on your hardware board to the
Newhaven GLCD.


How to post a schematic:
Use http://www.postimage.org or http://www.imageshack.com
or some other free image hosting service.
Upload your schematic to that website. Preferably a .JPG file or some
other commonly used image format.
Then post a link to your image here in the forum.

-------------
Edit:
Updated first link.


Last edited by PCM programmer on Mon Sep 21, 2015 12:03 am; edited 1 time in total
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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