Need some helpe with TFT Library

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
Jimmie
Posts: 45
Joined: 18 Apr 2008 12:12

Need some helpe with TFT Library

#1 Post by Jimmie » 09 Apr 2011 15:33

Hi i am testing the TFT library and it works fine for drawing shapes but when i add the TFT_Write_Char
and TFT_Write_Text I get a compile error saying: Too many actual parameters.
What does this mean and how do I solve it. Here is my code:

Code: Select all

  char *text = "electronics";
  char test2[2] = "7";

  
// TFT module connections
char TFT_DataPort at LATE;
char TFT_DataPort_Direction at TRISE;
sbit TFT_RST at LATC1_bit;
sbit TFT_BLED at LATD2_bit;
sbit TFT_RS at LATB15_bit;
sbit TFT_CS at LATF12_bit;
sbit TFT_RD at LATD5_bit;
sbit TFT_WR at LATD4_bit;
sbit TFT_RST_Direction at TRISC1_bit;
sbit TFT_BLED_Direction at TRISD2_bit;
sbit TFT_RS_Direction at TRISB15_bit;
sbit TFT_CS_Direction at TRISF12_bit;
sbit TFT_RD_Direction at TRISD5_bit;
sbit TFT_WR_Direction at TRISD4_bit;
// End Glcd module connections

// Touch Panel module connections
sbit DriveX_Left at LATB13_bit;
sbit DriveX_Right at LATB11_bit;
sbit DriveY_Up at LATB12_bit;
sbit DriveY_Down at LATB10_bit;
sbit DriveX_Left_Direction at TRISB13_bit;
sbit DriveX_Right_Direction at TRISB11_bit;
sbit DriveY_Up_Direction at TRISB12_bit;
sbit DriveY_Down_Direction at TRISB10_bit;
// End Touch Panel module connections

// Global variables
unsigned int Xcoord, Ycoord;
char PenDown;
void *PressedObject;
int PressedObjectType;
unsigned int caption_length, caption_height;
unsigned int display_width, display_height;

 // Example of establishing 16-bit communication between TFT display and PORTD, PORTE of MCU :






void PMPWaitBusy() {
  while(PMMODEbits.BUSY);
}

void SetIndex(unsigned short index) {
  TFT_RS = 0;
  PMDIN = index;
  PMPWaitBusy();
}

void WriteCommand( unsigned short cmd ) {
  TFT_RS = 1;
  PMDIN = cmd;
  PMPWaitBusy();
}

void WriteData(unsigned int _data) {
  TFT_RS = 1;
  PMDIN = _data;
  PMPWaitBusy();
}

static void InitializeTouchPanel() {
  AD1PCFG = 0xFFFF;
  PCFG12_bit = 0;
  PCFG13_bit = 0;
  // PMP setup
  PMMODE = 0;
  PMAEN  = 0;
  PMCON  = 0;  // WRSP: Write Strobe Polarity bit
  PMMODEbits.MODE = 2;     // Master 2
  PMMODEbits.WAITB = 0;
  PMMODEbits.WAITM = 1;
  PMMODEbits.WAITE = 0;
  PMMODEbits.MODE16 = 1;   // 16 bit mode
  PMCONbits.CSF = 0;
  PMCONbits.PTRDEN = 1;
  PMCONbits.PTWREN = 1;
  PMCONbits.PMPEN = 1;
  ADC1_Init();
    TFT_Set_Active(SetIndex,WriteCommand,WriteData);
  TFT_Init(320, 240);

  TP_TFT_Init(320, 240, 13, 12);                                  // Initialize touch panel
  TP_TFT_Set_ADC_Threshold(1000);                              // Set touch panel ADC threshold

  PenDown = 0;
  PressedObject = 0;
  PressedObjectType = -1;
}

void main() {
    TRISE = 0;
  TRISD = 0;

  //TFT_Set_Active(Set_Index,Write_Command,Write_Data);
  TFT_Init(320, 240);


  InitializeTouchPanel();

  // You can get calibration constants using touch panel calibration example
  TP_TFT_Set_Calibration_Consts(76, 907, 77, 915);    // Set calibration constants


 TFT_Fill_Screen(CL_WHITE);

  TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL);

 

  TFT_Set_Brush(0, 0, 1, LEFT_TO_RIGHT, CL_BLACK, CL_WHITE);



 TFT_Rectangle(20, 20, 219, 107);
   TFT_Circle(120, 64, 110);
    TFT_Write_Text("test", 4, 4,);  //<<<<<<<<<<<<<<<<<<<<<<<<<<<< compiler complains here
 //  TFT_Write_Char('A',22,23,);


while(1)
{
}
}


Also I wonder if anyone knows a easy way to get the name of all the files from a FAT16 SD card using the Multi Media Card Library

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Need some helpe with TFT Library

#2 Post by tihomir.losic » 11 Apr 2011 09:47

Hello,

you have one " , " behind second 4 (line 125), and that caused error

Code: Select all

TFT_Write_Text("test", 4, 4,);  //<<<<<<<<<<<<<<<<<<<<<<<<<<<< compiler complains here
Best regards,

Losic Tihomir
mikroElektronika [Support team]

Toley
Posts: 922
Joined: 03 Sep 2008 16:17

Re: Need some helpe with TFT Library

#3 Post by Toley » 11 Apr 2011 20:47

This is how it appears in the help file.

Code: Select all

TFT_Write_Text("TFT LIBRARY DEMO, WELCOME !", 0, 0,);
If someone do a copy n paste, he get this error.
Serge T.
Learning is an endeless process but it must start somewhere!

Jimmie
Posts: 45
Joined: 18 Apr 2008 12:12

Re: Need some helpe with TFT Library

#4 Post by Jimmie » 11 Apr 2011 21:30

Thank you, yes I only mad a copy paste from the example in the library without checking properly :oops: .

I also wonder if there will be a TFT bitmap editor soon that converts pictures from jpg to hex data. Or are there any other ways to print BMP/JPG pictures using “TFT_Image_Jpeg” or “TFT_Image” function.

Toley
Posts: 922
Joined: 03 Sep 2008 16:17

Re: Need some helpe with TFT Library

#5 Post by Toley » 11 Apr 2011 21:38

Hi Jimmie,

Visual TFT can generate the data table. You can use the demo version and only use it to covert your images.
Serge T.
Learning is an endeless process but it must start somewhere!

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: Need some helpe with TFT Library

#6 Post by phil31 » 12 Apr 2011 21:26

Ho Toley,

do you find a way to generate the data tab to use the "TFT_image" instead "TFT_image_jpeg" procedure ?

thanks
phil

Toley
Posts: 922
Joined: 03 Sep 2008 16:17

Re: Need some helpe with TFT Library

#7 Post by Toley » 12 Apr 2011 21:42

Hi phil31
do you find a way to generate the data tab to use the "TFT_image" instead "TFT_image_jpeg" procedure ?
I'm not sure I understand what you mean, but jpeg are jpeg and they need decoding. TFT_Image is used to print uncompressed images (bmp) and TFT_Image_Jpeg is used to print jpeg.
Serge T.
Learning is an endeless process but it must start somewhere!

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Need some helpe with TFT Library

#8 Post by tihomir.losic » 13 Apr 2011 08:56

Jimmie wrote:I also wonder if there will be a TFT bitmap editor soon that converts pictures from jpg to hex data. Or are there any other ways to print BMP/JPG pictures using “TFT_Image_Jpeg” or “TFT_Image” function.
Hello,

you can use our tool Visual TFT in order to generates a code that can be used in the appropriate compiler.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroC PRO for PIC32 General”