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

S1D13700 driver code
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
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

S1D13700 driver code
PostPosted: Mon Nov 25, 2019 11:35 pm     Reply with quote

ccs c 5.091
processor dsPIC33EP512GM710

I'm looking for the s1d13700 driver code written to the ccs c compiler. Could you share it if you have it? The screen I use NHD-320240WG-BxTGH-VZ#-3VR
thank you very much
_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 12:14 am     Reply with quote

Have a look at:

<http://www.ccsinfo.com/forum/viewtopic.php?t=46223&highlight=s1d13700>
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 26, 2019 12:36 am     Reply with quote

I looked. but it has never been more literally running.
_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 1:36 am     Reply with quote

What do you mean "it has never been more literally running".

You will have to change every 'int16' entry to 'unsigned int16', and every
'int8' to 'unsigned int8', and most of the pin references. Particularly the
byte wide output 'output_d', which you will have to either add a byte wide
output routine to do, or mask the port (the former is probably easier,
just declare a #BYTE variable to talk to the low 8bits of the port you want
to use, and connect the chip to this - set TRIS before using - same for the
read routine). Remember to use LAT for output and the port for input.
Fairly basic tweaking to make it work on the PIC33.
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 26, 2019 1:39 am     Reply with quote

I don't use port d. The pins I can use should be as follows. My hardware is suitable for these pins.
Code:

#define S1D13700_Data_A0      PIN_D5
#define S1D13700_Data_RW     PIN_D13
#define S1D13700_Data_E        PIN_D12
#define S1D13700_Data_CS      PIN_D6
#define S1D13700_Data_RST    PIN_C9

#define S1D13700_Data_DB0    PIN_F1
#define S1D13700_Data_DB1    PIN_G1
#define S1D13700_Data_DB2    PIN_G0
#define S1D13700_Data_DB3    PIN_F6
#define S1D13700_Data_DB4    PIN_F7
#define S1D13700_Data_DB5    PIN_G14
#define S1D13700_Data_DB6    PIN_G12
#define S1D13700_Data_DB7    PIN_G13

_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 2:02 am     Reply with quote

That makes it really hard. Splitting the output byte to bits on several
ports. You will have to do something like (in place of output_d):
Code:

void output_byte(uint8_t val) //assumes stdint.h is loaded
{
    if (bit_test(val,0))
        output_high(S1D13700_Data_DB0);
    else
        output_low(S1D13700_Data_DB0);

    if (bit_test(val,1))
        output_high(S1D13700_Data_DB1);
    else
        output_low(S1D13700_Data_DB1);

    if (bit_test(val,2))
        output_high(S1D13700_Data_DB2);
    else
        output_low(S1D13700_Data_DB2);

    if (bit_test(val,3))
        output_high(S1D13700_Data_DB3);
    else
        output_low(S1D13700_Data_DB3);

    if (bit_test(val,4))
        output_high(S1D13700_Data_DB4);
    else
        output_low(S1D13700_Data_DB4);

    if (bit_test(val,5))
        output_high(S1D13700_Data_DB5);
    else
        output_low(S1D13700_Data_DB5);

    if (bit_test(val,6))
        output_high(S1D13700_Data_DB6);
    else
        output_low(S1D13700_Data_DB6);

    if (bit_test(val,7))
        output_high(S1D13700_Data_DB7);
    else
        output_low(S1D13700_Data_DB7);
}

and a similar one reading the bits into a byte for input_d.

Though a bit cumbersome, this is as efficient in code terms as any other
solution. Lesson is though when laying out something that uses byte
wide data input/output, do try to put the pins onto consecutive port
bits. Will speed things and save a lot of code....


Last edited by Ttelmah on Tue Nov 26, 2019 7:31 am; edited 1 time in total
temtronic



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

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 5:52 am     Reply with quote

There's also a hardware solution, for maybe $2.
Buy a smaller PIC and code the diplay driver into it. Connect to your PIC on 1 I/O pin, then send display data to it.
There are 'interface modules' like this for the LCD1602 style LCDs, maybe someone makes them for the GLCD you have ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 7:41 am     Reply with quote

It only takes 0.8uSec to run the output_byte as shown. Fast enough I'd suspect
to be totally acceptable. So though not elegant. Good enough.
(assuming he is at 120MHz).

The chip itself is a GLCD to basic parallel interface, so probably not worth
trying to switch to using basic text mode....
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 8:31 am     Reply with quote

Just written an 'input_byte' for the same configuration:
Code:

uint8_y input_byte(void) //assumes stdint.h is loaded
{
    uint8_t rval=0;
    if (input(S1D13700_Data_DB0))
        bit_set(rval,0);
    if (input(S1D13700_Data_DB1))
        bit_set(rval,1);
    if (input(S1D13700_Data_DB2))
        bit_set(rval,2);
    if (input(S1D13700_Data_DB3))
        bit_set(rval,3);
    if (input(S1D13700_Data_DB4))
        bit_set(rval,4);
    if (input(S1D13700_Data_DB5))
        bit_set(rval,5);
    if (input(S1D13700_Data_DB6))
        bit_set(rval,6);
    if (input(S1D13700_Data_DB7))
        bit_set(rval,7);
    return rval;
}


replace 'input_d' with a call to this.
temtronic



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

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 8:31 am     Reply with quote

I offered the HW solution as it's 'old skool', had to make several over the decades to upgrade 'reliable' equipment .
hmm, sounds like a 'Flex-GLCD' driver might be an answer !

Jay
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 26, 2019 8:47 am     Reply with quote

I wrote but it doesn't work.
Code:

#ifdef DELAYS_48MHZ
#define delay_xt  5
#endif

#ifdef DELAYS_20MHZ
#define delay_xt  1
#endif

#define S1D13700_Data_A0   PIN_D5
#define S1D13700_Data_RW   PIN_D13
#define S1D13700_Data_E   PIN_D12
#define S1D13700_Data_CS   PIN_D6
#define S1D13700_Data_RST  PIN_C9

#define S1D13700_Data_DB0  PIN_F1
#define S1D13700_Data_DB1  PIN_G1
#define S1D13700_Data_DB2  PIN_G0
#define S1D13700_Data_DB3  PIN_F6
#define S1D13700_Data_DB4  PIN_F7
#define S1D13700_Data_DB5  PIN_G14
#define S1D13700_Data_DB6  PIN_G12
#define S1D13700_Data_DB7  PIN_G13

#define GLCD_WIDTH         320
#define GLCD_HEIGHT        240
#define GLCD_CHAR_WIDTH    8
#define GLCD_CHAR_HEIGHT   8

#define ON                 1
#define OFF                0

#define COMMAND_MODE    output_high(S1D13700_Data_A0);
#define DATA_MODE       output_low(S1D13700_Data_A0);

#DEFINE S1D13700_GRAPHICSTART 0x2580

void GlcdPutData(INT8 data);
int8 TakeData(void);
void GLCD_WriteCommand(int8 commandToWrite);
void GLCD_WriteData(int8 dataToWrite);
int8 GLCD_ReadData(void);
void setCursorAddress(int16 addr);
void GlcdGotoTextXY(int16 x, int16 y);
void GlcdPutC(char c);
void FillText(char cara);
void FillGraphic(int1 parameter);
void glcd_RAinit(void);
int8 GLCD_ReadStatus(void);

   void GlcdPutData(int8 data)
   {
      output_bit(S1D13700_Data_DB0, bit_test(data,0));     
      output_bit(S1D13700_Data_DB1, bit_test(data,1));                   
      output_bit(S1D13700_Data_DB2, bit_test(data,2));                   
      output_bit(S1D13700_Data_DB3, bit_test(data,3));
      output_bit(S1D13700_Data_DB4, bit_test(data,4));
      output_bit(S1D13700_Data_DB5, bit_test(data,5));                   
      output_bit(S1D13700_Data_DB6, bit_test(data,6));                 
      output_bit(S1D13700_Data_DB7, bit_test(data,7));
   }

   int8 TakeData(VOID)
   {
      INT8 data = 0;
      data += input (S1D13700_Data_DB0);
      data += input (S1D13700_Data_DB1) * 2;
      data += input (S1D13700_Data_DB2) * 4;
      data += input (S1D13700_Data_DB3) * 8;
      data += input (S1D13700_Data_DB4) * 16;
      data += input (S1D13700_Data_DB5) * 32;
      data += input (S1D13700_Data_DB6) * 64;
      data += input (S1D13700_Data_DB7) * 128;
      RETURN data;
   }
   
   void GLCD_WriteData(int8 dataToWrite)         // Changes
   {
      GlcdPutData(dataToWrite);
      output_low(S1D13700_Data_E);

      DATA_MODE

      output_low(S1D13700_Data_RW);
      output_low(S1D13700_Data_CS);

      delay_cycles(5);
      output_high(S1D13700_Data_E);
      delay_cycles(5);
      output_low(S1D13700_Data_E);

      output_high(S1D13700_Data_RW);
      output_high(S1D13700_Data_CS);
    }
     
     int8 GLCD_ReadData(void)            // Changes
     {
       int8 tmp;

       output_low(S1D13700_Data_E);

       output_low(S1D13700_Data_CS);
       output_high(S1D13700_Data_A0);
       output_high(S1D13700_Data_RW);

       delay_cycles(5);
       output_high(S1D13700_Data_E);
       delay_cycles(5);
       tmp = TakeData();
       output_low(S1D13700_Data_E);

      output_high(S1D13700_Data_CS);

      return tmp;
     }
     
     void S1D13700_INIT(void)
     {
 
         output_high(S1D13700_Data_RST);
         output_high(S1D13700_Data_CS);
         output_high(S1D13700_Data_E);
         output_high(S1D13700_Data_RW);
   
   //system set
         GLCD_WriteCommand(0x40);
         GLCD_WriteData(0x30);
         GLCD_WriteData(0x87);
         GLCD_WriteData(0x07);
         GLCD_WriteData(0x27);
         GLCD_WriteData(0x2F);
         GLCD_WriteData(0xEF);
         GLCD_WriteData(0x28);
         GLCD_WriteData(0x00);
   
   //scroll
         GLCD_WriteCommand(0x44);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0xF0);
         GLCD_WriteData(0x80);
         GLCD_WriteData(0x25);
         GLCD_WriteData(0xF0);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0x4B);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0x00);
   //HDOT SCR
   
         GLCD_WriteCommand(0x5A);
         GLCD_WriteData(0x00);
   
   //OVLAY
         GLCD_WriteCommand(0x5B);
         GLCD_WriteData(0x01);
   
   //erase all screen
         FillGraphic(OFF);
         FillText(' ');
   
   //DISP ON
         GLCD_WriteCommand(0x58);
         GLCD_WriteData(0x56);
   
   //CSRFORM
         GLCD_WriteCommand(0x5D);
         GLCD_WriteData(0x04);   
         GLCD_WriteData(0x86);
   
   //DISP ON
         GLCD_WriteCommand(0x59);
   
   //CSDIR
         GLCD_WriteCommand(0x4C);
   
   //CSRW
         setCursorAddress(0x0000);
     }
     
     void FillGraphic(int1 parameter)
      {
         long count;
   //set cursor to 2580h
         setCursorAddress(0x2580);
   //put 00h in all graphic space
         count = 9600;
         GLCD_WriteCommand(0x42);
         while(count != 0)
         {   
            GLCD_WriteData(0xFF * parameter);
            count--;
         }
      }
   
      void FillText(char cara)
      {
         long count;
   //set cursor to 0000h
         setCursorAddress(0x0000);
   //put 00h in all text space
         count = 1200;
         GLCD_WriteCommand(0x42);
         while(count != 0)
         {
            GLCD_WriteData(cara);
            count--;
         }
      }
   
   void GlcdPutC(char c)
   {
      GLCD_WriteCommand(0x42);
      GLCD_WriteData(c);
   }
   
//x and y : 1 to max   
   void GlcdGotoTextXY(int16 x, int16 y)
   {
      int16 adress = 0;
      adress = (y-1)*40;
      adress = adress+ x-1;
      setCursorAddress(adress);
   }
   
   void setCursorAddress(int16 addr)
   {
      int8 adress;
      GLCD_WriteCommand(0x46);
      adress = addr & 0xFF;
      GLCD_WriteData(adress);
      adress = addr >> 8;
      GLCD_WriteData(adress);
   }

   void GLCD_Pixel(int16 x,int16 y, int1 color)
   {
      int8 tmp = 0;
      int16 address = 0;

      address = S1D13700_GRAPHICSTART + (40 * y) + (x/8);

      setCursorAddress(address);
      GLCD_WriteCommand(0x43);

      GLCDPutData(0x00);

      set_tris_d(0xFF);         // Set the Port D as inputs before I call
               // GLCD_ReadData; it doesn't work
               // without this line.
               // The rest is the same.
      tmp = GLCD_ReadData();
      set_tris_d(0x00);         // Port D as outputs again.

      if(color == ON)
      tmp |= (1 << (7 - (x % 8)));
      else
      tmp &= ~(1 << (7 - (x % 8)));

      setCursorAddress(address);
      GLCD_WriteCommand(0x42);
      GLCD_WriteData(tmp);
   }

   void GLCD_GraphicGoTo(int16 x,int16 y)
   {
      setCursorAddress(S1D13700_GRAPHICSTART + (y * 40) + x/8);
   }

   int8 GLCD_ReadStatus(void)
   {
      int8 tmp;

      output_low(S1D13700_Data_E);
      output_low(S1D13700_Data_CS);
      output_low(S1D13700_Data_A0);
      delay_cycles(5);
      output_high(S1D13700_Data_E);
      delay_cycles(5);
      delay_cycles(5);
      tmp = takedata();
      output_low(S1D13700_Data_E);
      output_high(S1D13700_Data_CS);
      output_high(S1D13700_Data_A0);
      return tmp;
   }

_________________
Es
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 8:58 am     Reply with quote

You were told by Ttelmah to do this:
Quote:

You will have to change every 'int16' entry to 'unsigned int16', and every
'int8' to 'unsigned int8', and most of the pin references.

But you didn't do it.
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 26, 2019 9:03 am     Reply with quote

so I did. It did not work.

Code:

#ifdef DELAYS_48MHZ
#define delay_xt  5
#endif

#ifdef DELAYS_20MHZ
#define delay_xt  1
#endif

#define S1D13700_Data_A0   PIN_D5
#define S1D13700_Data_RW   PIN_D13
#define S1D13700_Data_E   PIN_D12
#define S1D13700_Data_CS   PIN_D6
#define S1D13700_Data_RST  PIN_C9

#define S1D13700_Data_DB0  PIN_F1
#define S1D13700_Data_DB1  PIN_G1
#define S1D13700_Data_DB2  PIN_G0
#define S1D13700_Data_DB3  PIN_F6
#define S1D13700_Data_DB4  PIN_F7
#define S1D13700_Data_DB5  PIN_G14
#define S1D13700_Data_DB6  PIN_G12
#define S1D13700_Data_DB7  PIN_G13

#define GLCD_WIDTH         320
#define GLCD_HEIGHT        240
#define GLCD_CHAR_WIDTH    8
#define GLCD_CHAR_HEIGHT   8

#define ON                 1
#define OFF                0

#define COMMAND_MODE    output_high(S1D13700_Data_A0);
#define DATA_MODE       output_low(S1D13700_Data_A0);

#DEFINE S1D13700_GRAPHICSTART 0x2580

void GlcdPutData(unsigned int8 data);
unsigned int8 TakeData(void);
void GLCD_WriteCommand(unsigned int8 commandToWrite);
void GLCD_WriteData(unsigned int8 dataToWrite);
unsigned int8 GLCD_ReadData(void);
void setCursorAddress(unsigned int16 addr);
void GlcdGotoTextXY(unsigned int16 x, unsigned int16 y);
void GlcdPutC(char c);
void FillText(char cara);
void FillGraphic(int1 parameter);
void glcd_RAinit(void);
unsigned int8 GLCD_ReadStatus(void);

   void GlcdPutData(unsigned int8 data)
   {
      output_bit(S1D13700_Data_DB0, bit_test(data,0));     
      output_bit(S1D13700_Data_DB1, bit_test(data,1));                   
      output_bit(S1D13700_Data_DB2, bit_test(data,2));                   
      output_bit(S1D13700_Data_DB3, bit_test(data,3));
      output_bit(S1D13700_Data_DB4, bit_test(data,4));
      output_bit(S1D13700_Data_DB5, bit_test(data,5));                   
      output_bit(S1D13700_Data_DB6, bit_test(data,6));                 
      output_bit(S1D13700_Data_DB7, bit_test(data,7));
   }

   int8 TakeData(VOID)
   {
      unsigned unsigned int8 data = 0;
      data += input (S1D13700_Data_DB0);
      data += input (S1D13700_Data_DB1) * 2;
      data += input (S1D13700_Data_DB2) * 4;
      data += input (S1D13700_Data_DB3) * 8;
      data += input (S1D13700_Data_DB4) * 16;
      data += input (S1D13700_Data_DB5) * 32;
      data += input (S1D13700_Data_DB6) * 64;
      data += input (S1D13700_Data_DB7) * 128;
      RETURN data;
   }
   
   void GLCD_WriteData(unsigned int8 dataToWrite)         // Changes
   {
      GlcdPutData(dataToWrite);
      output_low(S1D13700_Data_E);

      DATA_MODE

      output_low(S1D13700_Data_RW);
      output_low(S1D13700_Data_CS);

      delay_cycles(5);
      output_high(S1D13700_Data_E);
      delay_cycles(5);
      output_low(S1D13700_Data_E);

      output_high(S1D13700_Data_RW);
      output_high(S1D13700_Data_CS);
    }
     
     unsigned int8 GLCD_ReadData(void)            // Changes
     {
       unsigned int8 tmp;

       output_low(S1D13700_Data_E);

       output_low(S1D13700_Data_CS);
       output_high(S1D13700_Data_A0);
       output_high(S1D13700_Data_RW);

       delay_cycles(5);
       output_high(S1D13700_Data_E);
       delay_cycles(5);
       tmp = TakeData();
       output_low(S1D13700_Data_E);

      output_high(S1D13700_Data_CS);

      return tmp;
     }
     
     void S1D13700_INIT(void)
     {
 
         output_high(S1D13700_Data_RST);
         output_high(S1D13700_Data_CS);
         output_high(S1D13700_Data_E);
         output_high(S1D13700_Data_RW);
   
   //system set
         GLCD_WriteCommand(0x40);
         GLCD_WriteData(0x30);
         GLCD_WriteData(0x87);
         GLCD_WriteData(0x07);
         GLCD_WriteData(0x27);
         GLCD_WriteData(0x2F);
         GLCD_WriteData(0xEF);
         GLCD_WriteData(0x28);
         GLCD_WriteData(0x00);
   
   //scroll
         GLCD_WriteCommand(0x44);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0xF0);
         GLCD_WriteData(0x80);
         GLCD_WriteData(0x25);
         GLCD_WriteData(0xF0);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0x4B);
         GLCD_WriteData(0x00);
         GLCD_WriteData(0x00);
   //HDOT SCR
   
         GLCD_WriteCommand(0x5A);
         GLCD_WriteData(0x00);
   
   //OVLAY
         GLCD_WriteCommand(0x5B);
         GLCD_WriteData(0x01);
   
   //erase all screen
         FillGraphic(OFF);
         FillText(' ');
   
   //DISP ON
         GLCD_WriteCommand(0x58);
         GLCD_WriteData(0x56);
   
   //CSRFORM
         GLCD_WriteCommand(0x5D);
         GLCD_WriteData(0x04);   
         GLCD_WriteData(0x86);
   
   //DISP ON
         GLCD_WriteCommand(0x59);
   
   //CSDIR
         GLCD_WriteCommand(0x4C);
   
   //CSRW
         setCursorAddress(0x0000);
     }
     
     void FillGraphic(int1 parameter)
      {
         long count;
   //set cursor to 2580h
         setCursorAddress(0x2580);
   //put 00h in all graphic space
         count = 9600;
         GLCD_WriteCommand(0x42);
         while(count != 0)
         {   
            GLCD_WriteData(0xFF * parameter);
            count--;
         }
      }
   
      void FillText(char cara)
      {
         long count;
   //set cursor to 0000h
         setCursorAddress(0x0000);
   //put 00h in all text space
         count = 1200;
         GLCD_WriteCommand(0x42);
         while(count != 0)
         {
            GLCD_WriteData(cara);
            count--;
         }
      }
   
   void GlcdPutC(char c)
   {
      GLCD_WriteCommand(0x42);
      GLCD_WriteData(c);
   }
   
//x and y : 1 to max   
   void GlcdGotoTextXY(unsigned int16 x, unsigned int16 y)
   {
      unsigned int16 adress = 0;
      adress = (y-1)*40;
      adress = adress+ x-1;
      setCursorAddress(adress);
   }
   
   void setCursorAddress(unsigned int16 addr)
   {
      unsigned int8 adress;
      GLCD_WriteCommand(0x46);
      adress = addr & 0xFF;
      GLCD_WriteData(adress);
      adress = addr >> 8;
      GLCD_WriteData(adress);
   }

   void GLCD_Pixel(unsigned int16 x,unsigned int16 y, int1 color)
   {
      unsigned int8 tmp = 0;
      unsigned int16 address = 0;

      address = S1D13700_GRAPHICSTART + (40 * y) + (x/8);

      setCursorAddress(address);
      GLCD_WriteCommand(0x43);

      GLCDPutData(0x00);

      set_tris_d(0xFF);         // Set the Port D as inputs before I call
               // GLCD_ReadData; it doesn't work
               // without this line.
               // The rest is the same.
      tmp = GLCD_ReadData();
      set_tris_d(0x00);         // Port D as outputs again.

      if(color == ON)
      tmp |= (1 << (7 - (x % 8)));
      else
      tmp &= ~(1 << (7 - (x % 8)));

      setCursorAddress(address);
      GLCD_WriteCommand(0x42);
      GLCD_WriteData(tmp);
   }

   void GLCD_GraphicGoTo(unsigned int16 x,unsigned int16 y)
   {
      setCursorAddress(S1D13700_GRAPHICSTART + (y * 40) + x/8);
   }

   unsigned int8 GLCD_ReadStatus(void)
   {
      unsigned int8 tmp;

      output_low(S1D13700_Data_E);
      output_low(S1D13700_Data_CS);
      output_low(S1D13700_Data_A0);
      delay_cycles(5);
      output_high(S1D13700_Data_E);
      delay_cycles(5);
      delay_cycles(5);
      tmp = takedata();
      output_low(S1D13700_Data_E);
      output_high(S1D13700_Data_CS);
      output_high(S1D13700_Data_A0);
      return tmp;
   }

_________________
Es
temtronic



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

View user's profile Send private message

PostPosted: Tue Nov 26, 2019 9:05 am     Reply with quote

and..
there could be a timing probem.
delay_cycles(xx) is based upon the clock value.

if the original code was written where delay_cycle(1) = 1 us , that will be 5X faster( .2us), if your PIC clock is 5X faster than the original program.

there also might be the '5V PIC - 3V peripheral' problem, thoug I think that PIC is 3 Volts ? but what is the GLCD VDD ?
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 26, 2019 9:13 am     Reply with quote

pıc 3volt
dsPIC33EP512GM710
_________________
Es
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