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

PIC18F26K80 IO problem

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



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PIC18F26K80 IO problem
PostPosted: Mon Jan 01, 2024 7:22 am     Reply with quote

I have designing a new project. It need a small 2*16 LCD RC+8+2A-BIY-ESA. It doesn't work, because Enable pin doesn't work like other pins from 5V to 0. It works from 1.5V-0.9V.
I have looked other operations for this pin, but I have not found.
The only is SDO, but it is removed,

Maybe someone can help me?

Here is the code

#include <18F26K80.h>
#device adc=12
#use delay(internal=16MHz) // 500kHz, 1MHz, 2MHz,4MHx, 8MHz. 16MHz, 32MHz
int16 setup_oscillator(OSC_HFINTRC_16MHZ); //
#fuses NOWDT,NOPROTECT,noMCLR
#use rs232(UART2, baud=9600,ERRORS, STREAM = DEBUG) //debug print through the UART2 to PC
#use rs232(UART , baud=115200 ,errors,bits=8,parity=N, stop=1,receive_buffer=256)

void main(void)
{


port_a_pullups(0xFF) ; // these goes switch
// port_c_pullups(0xFF) ;
setup_ccp1(CCP_OFF ) ;
setup_ccp2(CCP_OFF ) ;
setup_ccp3(CCP_OFF ) ;
setup_ccp4(CCP_OFF ) ;
setup_ccp5(CCP_OFF ) ;
setup_spi(SPI_DISABLED );
setup_comparator(NC_NC_NC_NC );
setup_adc(ADC_OFF );
output_drive(PIN_C5);


while(1)
{
output_high(pin_C5); // RS =0
fprintf(DEBUG,"SPI disabled\r" );
fprintf(DEBUG,"Testing C5=1\r" );
delay_ms(1000);
output_low(pin_C5); // RS =0
fprintf(DEBUG,"Testing C5=0\r" );
delay_ms(1000);
}

}

I have two boards and they work similarly.

The schematic in here
http://probyte.fi/Can5.jpg

Regards
Pekka
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 7:42 am     Reply with quote

Can you post a link to the data sheet for this display?. Your part number
doesn't match any I can find.
I suspect you are not understanding the pin connections it needs. It sounds
as if the pin you think is enable, is actually the Vee or Vo pin. If so this is a
bias voltage to adjust the contrast, not an enable.
No logic input to a display will require you to use a voltage of the range you
are describing. The logic inputs will accept logic signals.

As a further comment, an RC0802 LCD will be an 8*2, not a 16*2 display.

So for example:
[url]
https://www.tme.eu/gb/details/rc0802a-biy-esx/lcd-alphanumeric-displays/raystar-optronics/
[/url]

The Vo connection will normally be done with just two fixed resistors or
a pot. Once set you don't have to change it on modern displays.
temtronic



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

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 8:05 am     Reply with quote

hay, this old dinosaur FOUND the LCD datasheet ! I used the part number in the schematic he provided !

Seems like a 'normal' LCD module to me, 'low' is 0.6 or less, high is 70% of VDD or more.

Perhaps there's some internal peripheral that needs to be disabled for the LCD to work properly or perhaps a wiring error ?
pekka1234



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PIC18F26K80 IO problem
PostPosted: Mon Jan 01, 2024 8:18 am     Reply with quote

I have CCS program version 5.115
Pekka
pekka1234



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 8:20 am     Reply with quote

LCD datasheet. It has not anything of programming

https://www.tme.eu/Document/20d21428062bb82a03b38f9b480951e5/RC0802A-BIY-ESX.pdf
pekka1234



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 9:32 am     Reply with quote

Sorry, I mean 2*8 LCD

Pekka
pekka1234



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 9:35 am     Reply with quote

Well, I have two PCBs.
And I have tested both.
I think it is my fault, but I asked help.
I have always got help here.

Pekka
temtronic



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

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 9:40 am     Reply with quote

You can probably use the CCS 'lcd driver', though I prefer the 'flex LCD driver'.
It's in the 'code library' as a 'sticky', top of the list as 'flexible LCD driver'.
download it, then make a COPY, call it 'myLCD...' or similar. Add THAT version to your program, make appropriate changes to pin uses.
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 9:59 am     Reply with quote

OK.
Standard 8*2 text LCD. The enable pin is normal logic. Doesn't use 1.5 to
0.9v. If you look it says it uses H->L voltage levels.
What on earth makes you think this pin needs these low levels?.
It doesn't.

I'd suggest you use the flex LCD driver in the code library.
Nothing you post shows you trying to talk to the LCD. All you are doing is
operating pin C5. C5 is the register select line. Won't do anything till
the LCD is initialised.

Just use the 16*2 driver, and change the setup lines to:
Code:

#define LCD_DB4   PIN_C0
#define LCD_DB5   PIN_C1
#define LCD_DB6   PIN_C2
#define LCD_DB7   PIN_C3

#define LCD_E     PIN_C4
#define LCD_RS    PIN_C5

//#define USE_LCD_RW   1 //Remmed out, this is 6pin interface

You must pause for at least a couple of hundred mSec before trying to
talk to the LCD.
pekka1234



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PostPosted: Mon Jan 01, 2024 11:56 am     Reply with quote

Thank you for help Thelmah.

There was some mistake in my LCD driver .

I got almost two line of displays, but not perfect
The third and forth letter is blank on the both rows.

Look the picture
http://probyte.fi/LCDDriver.jpg

I took RW off and replayed it with suitable delay ( from some cycles to 1ms)
It may be wrong.

The main code is here
It works first rows with 5 sec delay, but then it started to run all the letters,
although I put it only 8 letter per row.
The rows go right, but the characters rolls from start charters to the end,

#include <18F26K80.h>
#device adc=12
#use delay(internal=16MHz) // 500kHz, 1MHz, 2MHz,4MHx, 8MHz. 16MHz, 32MHz
int16 setup_oscillator(OSC_HFINTRC_16MHZ); //
#fuses NOWDT,NOPROTECT,noMCLR
#use rs232(UART2, baud=9600,ERRORS, STREAM = DEBUG) //debug print through the UART2 to PC
#use rs232(UART , baud=115200 ,errors,bits=8,parity=N, stop=1,receive_buffer=256)
#include "flexdriver.c"

void main(void)
{
int i;

port_a_pullups(0xFF) ; // these goes switch
// port_c_pullups(0xFF) ;
setup_ccp1(CCP_OFF ) ;
setup_ccp2(CCP_OFF ) ;
setup_ccp3(CCP_OFF ) ;
setup_ccp4(CCP_OFF ) ;
setup_ccp5(CCP_OFF ) ;
setup_spi(SPI_DISABLED );
setup_comparator(NC_NC_NC_NC );
setup_adc(ADC_OFF );
lcd_init_custom_chars() ;
fprintf(DEBUG,"LCD_INIT\r" );
delay_ms(1000);
lcd_init() ;
lcd_gotoxy( 1, 1) ; // goto to place 1 to row 1
lcd_putc( 'A');
lcd_putc( 'B');
lcd_putc( 'C');
lcd_putc( 'D');
lcd_putc( 'E');
lcd_putc( 'F');
lcd_putc( 'G');
delay_ms(5000);
lcd_gotoxy( 1, 2) ;
lcd_putc( 'H');

lcd_putc( 'I');

lcd_putc( 'J');

lcd_putc( 'K');

lcd_putc( 'L');

lcd_putc( 'M');
;
lcd_putc( 'N');

delay_ms(5000);
while(1)
{
for(i=0;3<8+3; i++)
{
fprintf(DEBUG,"Row 1 %c\r" , i+'A');
lcd_putc( i+'C');
fprintf(DEBUG,"Row 1 %d %c\r" , i, i+'A');

}
lcd_gotoxy( 1, 2) ;// goto to place 1 to row 2
for(i=0;3<8+3; i++)
{

lcd_putc( i+'H');
fprintf(DEBUG,"row 2 Print %d %c\r" , i, i+'H');

}
}
}

Maybe I have to put my modified LCD code also

Pekka
pekka1234



Joined: 28 May 2017
Posts: 74

View user's profile Send private message

PIC18F26K80 IO problem
PostPosted: Mon Jan 01, 2024 1:35 pm     Reply with quote

Thelmah
I got the problem, It was the other LCD, because the other LCD works normally.
I will clarify this.

Picrure
http;//probyte.fi/Picture1.jpg
There seems to be no problem in LCD.
==
There was in Can driver a problem.
I was bought TJA1040 drivers from TME (a Polish Electronic shop),
It looked like normal SMD 8-in device, but when I tried to put it to PCB. I can't know where is pin 1.
I tried to get help from TME. but they send only their sales address.

I tried to clarify from NPX, which is a manufacture of the device.
They send to me a datasheet, where there was pin 1 clearly marked,
Then I send to NPX picture of my device.
Then they explained which way the device is put on plastic roll.
So if you try to put this device with your hand is very difficult.
There was no marking of the pin 1.

Regards
Pekka
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Tue Jan 02, 2024 5:36 am     Reply with quote

Pin 1 is not marked. The _row_ that is 1...4 is marked. If you look at the
top edges, one is beveled. This edge is the one that has the 1..4 legs.

This is a standard marking for some SO8 packages.
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