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

Led display interfacing

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



Joined: 13 Oct 2015
Posts: 9

View user's profile Send private message

Led display interfacing
PostPosted: Tue Jan 19, 2016 6:45 am     Reply with quote

Hi guys
I have to interface pic16f877a with p10 display.
It is said that it should be done by using hub 12 protocol. P10 has 16 pins in the input side. I don't know how to start with.

Reference
http://blog.vettore.org/building-a-large-led-sign-with-inexpensive-standard-modules-and-arduino/

It is said in that site to communicate using spi.
Somebody please help very urgent .....
temtronic



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

View user's profile Send private message

PostPosted: Tue Jan 19, 2016 8:24 am     Reply with quote

That article seems to have C code that works so it's a fairly simple task to convert to CCS C. Start by printing out the complete program, then take each function and convert into CCS C. You will of course have to read and understand BOTH versions of C. Start with a simple functions first then build upon what you learn.
It is not possible for me to do this for you as I do not have anyway of testing my code as I don't have those LED modules.

Jay
muralid



Joined: 13 Oct 2015
Posts: 9

View user's profile Send private message

PostPosted: Tue Jan 19, 2016 8:46 am     Reply with quote

thanks sir
But i am not stuck with code, i just want the hardware connection details.
There are two data pins in the led display.
I want to know which should be connected to which pin in the microcontroller.
In the led display port the pins are OE A, B, C SCK, CLK, and R.
temtronic



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

View user's profile Send private message

PostPosted: Tue Jan 19, 2016 10:24 am     Reply with quote

You should either contact the mfr or visit their website for the 'connections'.
Another way is to look at the program you have.It should have comments as to how it was connected. It is important to also know what speed it operates at.

The module is an SPI device so a minimum of 4 connections.
Without a proper part number or the actual device I can't easily help any further.


Jay
muralid



Joined: 13 Oct 2015
Posts: 9

View user's profile Send private message

PostPosted: Tue Jan 19, 2016 1:03 pm     Reply with quote

The model number of the p10 display is p10c4d1.3

Code for Arduino:
Code:

#include <SPI.h>
 
//Pins specific for Mega. See Arduino SPI for a different board.

#define A 22
#define B 24
#define OE 26
#define R1 51
#define CLK 52
#define STB 53
 
 
//row to be shown (1-4 since it is 1/4 scan)
byte row=0;
 
//brightness: increase->more bright
int br=500;
 
//some digits from a 8x8 font (numeric 1-8)
byte digits[]={
 
0x04,  //1
0x0C,
0x04,
0x04,
0x04,
0x04,
0x0E,
0x00,
 
0x0E, //2
0x11,
0x01,
0x02,
0x04,
0x08,
0x1F,
0x00,
 
 
0x1F, //3
0x02,
0x04,
0x02,
0x01,
0x11,
0x0E,
0x00,
 
0x02, //4
0x06,
0x0A,
0x12,
0x1F,
0x02,
0x02,
0x00,
 
0x1F, //5
0x10,
0x1E,
0x01,
0x01,
0x11,
0x0E,
0x00,
 
 
0x06, //6
0x08,
0x10,
0x1E,
0x11,
0x11,
0x0E,
0x00,
 
0x1F,//7
0x01,
0x02,
0x04,
0x04,
0x04,
0x04,
0x00,
 
 
0x0E,//8
0x11,
0x11,
0x0E,
0x11,
0x11,
0x0E,
0x00,
 
 
 
 
 
};
 
 
 
void setup () {
     pinMode(A, OUTPUT);
     pinMode(B, OUTPUT);
     pinMode(OE, OUTPUT);
     pinMode(R1, OUTPUT);
     pinMode(CLK, OUTPUT);
     pinMode(STB, OUTPUT);
     SPI.begin();
     delay(300);
}   
 
 
//display alternatively scan lines
void loop(){
       showRow(0);
       showRow(1);
       showRow(2);
       showRow(3);
}
 
 
//Load and show row (1-4) i.e. 1 and 5, 2 and 6.....
void showRow(int row){
 
      SPI.transfer(~(digits[row+36]));   //5
      SPI.transfer(~(digits[row+32]));             
 
      SPI.transfer(~(digits[row+4]));    //1
      SPI.transfer(~(digits[row]));           
 
      SPI.transfer(~(digits[row+44]));   //6
      SPI.transfer(~(digits[row+40]));             
 
      SPI.transfer(~(digits[row+12]));   //2
      SPI.transfer(~(digits[row+8]));             
 
      SPI.transfer(~(digits[row+52]));   //7
      SPI.transfer(~(digits[row+48]));             
 
      SPI.transfer(~(digits[row+20]));   //3
      SPI.transfer(~(digits[row+16]));             
 
      SPI.transfer(~(digits[row+60]));   //8
      SPI.transfer(~(digits[row+56]));             
 
      SPI.transfer(~(digits[row+28]));   //4
      SPI.transfer(~(digits[row+24]));             
 
      digitalWrite(STB,LOW);
      digitalWrite(STB,HIGH);
 
      scanrow(row);//enable encoder for the line loaded
 
      //PWM like. Change br to adjust brightnes
      digitalWrite(OE,HIGH);
      delayMicroseconds(br);
      digitalWrite(OE,LOW);
      delayMicroseconds(900);
 
 
}
 
//enable encoder for this row in order to show it
void scanrow(int r){
    if(r==0){
      digitalWrite(A,0);
      digitalWrite(B,0);
    } 
    else if(r==1){
      digitalWrite(A,1);
      digitalWrite(B,0);
    }
    else if(r==2){
      digitalWrite(A,0);
      digitalWrite(B,1);
    }
    else if(r==3){
      digitalWrite(A,1);
      digitalWrite(B,1);
    }
}
 


and for ccs modified by myself
Code:

#include "E:\COMMUNICATION.h"
void showrow(int row);
void scanrow(int r);
//int i;
byte row=0;
byte digits[]={0x04,  //1
0x0C,
0x04,
0x04,
0x04,
0x04,
0x0E,
0x00,
 
0x0E, //2
0x11,
0x01,
0x02,
0x04,
0x08,
0x1F,
0x00,
 
 
0x1F, //3
0x02,
0x04,
0x02,
0x01,
0x11,
0x0E,
0x00,
 
0x02, //4
0x06,
0x0A,
0x12,
0x1F,
0x02,
0x02,
0x00,
 
0x1F, //5
0x10,
0x1E,
0x01,
0x01,
0x11,
0x0E,
0x00,
 
 
0x06, //6
0x08,
0x10,
0x1E,
0x11,
0x11,
0x0E,
0x00,
 
0x1F,//7
0x01,
0x02,
0x04,
0x04,
0x04,
0x04,
0x00,
0x0E,//8
0x11,
0x11,
0x0E,
0x11,
0x11,
0x0E,
0x00,

};
void showrow(int row)
{
spi_write(~(digits[row=36]));
spi_write(~(digits[row=32]));

spi_write(~(digits[row=4]));
spi_write(~(digits[row]));

spi_write(~(digits[row=44]));
spi_write(~(digits[row=40]));

spi_write(~(digits[row=12]));
spi_write(~(digits[row=8]));

spi_write(~(digits[row=52]));
spi_write(~(digits[row=48]));

spi_write(~(digits[row=20]));
spi_write(~(digits[row=16]));

spi_write(~(digits[row=60]));
spi_write(~(digits[row=56]));

spi_write(~(digits[row=28]));
spi_write(~(digits[row=24]));

output_high(pin_c5);
output_low(pin_c5);

scanrow(row);

 output_HIGH(pin_b2);
   delay_ms(100);
     output_LOW(pin_b2);
     delay_ms(100);
}
void scanrow(int r)
{
if(r==0)
{
output_low(pin_b0);
output_low(pin_b1);
}
else if(r==1)
{
output_high(pin_b0);
output_low(pin_b1);
}
if(r==2)
{
output_low(pin_b0);
output_high(pin_b1);
}
if(r==2)
{
output_high(pin_b0);
output_high(pin_b1);
}

}
void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_4);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
set_tris_b(0b00000000);
//set_tris_C(0b00000000);
set_tris_d(0b00000000);
 
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_4 );

While(1)
  {
  showrow(0);
  showrow(1);
  showrow(2);
  showrow(3);
 
 /* output_low(pin_d2);
  delay_ms(500);
output_high(pin_d2);
delay_ms(500);
   
     */
  }

}


pin details of p10 display

1 OE Enable signal
2 A Line Power Control Signal
3 GND
4 B Line Power Control Signal
5 GND
6 F F
7 GND
8 CLK Clock Signal
9 GND
10 LAT
11 GND
12 R Red Signal
13 GND
14 F F
15 GND
16 F

and for spi from microcontroller we only use sdi, sdo and sck.
janvandeklok



Joined: 20 Jan 2021
Posts: 1

View user's profile Send private message AIM Address

Using 2 colour RG display
PostPosted: Wed Jan 20, 2021 9:00 am     Reply with quote

Hello,

Could you tell me how I could turn the leds to Yellow and / or green ?

Jan
gaugeguy



Joined: 05 Apr 2011
Posts: 303

View user's profile Send private message

PostPosted: Wed Jan 20, 2021 9:34 am     Reply with quote

How is that related to this message thread about a RED display?
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Jan 20, 2021 10:37 am     Reply with quote

If you Google p10c4d1 connections you will even
find a video showing how to connect the panel(s). Lots out there!
_________________
Google and Forum Search are some of your best tools!!!!
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