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

LCD HD44780 PCF8574T i2c Driver
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 12:45 pm     Reply with quote

I do have the 5V, 3V, and both ground connections. I just gave up and replaced the board with a homemade level translator using 2 2N2222A NPN transistors and 4 5.1K pull up resistors. Basically, I made the circuit on page 10 of this: http://www.adafruit.com/datasheets/an97055.pdf though I didn't have MOSFETs so I used the NPNs. I added 2.2K resistors to the base of each transistor to limit current.

This homemade translator appears to work! At least there is now what appears to be clean data on both the 3V and 5V sides of the translator, and the 3V side pulls up correctly to 3V, and the 5V side correctly to 5V. My problem now is the display itself is not displaying a message. It just displays a blue background with the top line white squares. Could this be a code issue?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 12:59 pm     Reply with quote

If you think i2c is working, now go run the i2c bus scanner:
http://www.ccsinfo.com/forum/viewtopic.php?t=49713
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 1:01 pm     Reply with quote

hmmm, the chip on my i2c module says (in the tinyest of print) pca8674, so thinking maybe slightly different code might be needed? Also I think the pins to the LCD are different then what is in the code. I am not sure the exact pinout because I can't seem to find a datasheet for my module anywhere
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 1:12 pm     Reply with quote

Email the company and ask for the documentation.
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 1:20 pm     Reply with quote

How do I use the printf? Like I said I never used PIC before and I don't even know what pin to use to get printf to work. Here is the programmer I am using:
http://www.ccsinfo.com/faq.php?page=connect_icd
I have everything connected except the one that says: Pin B3 on target PICĀ® MCU or PICĀ® DSC - C Aware Real-Time Debugging (Optional). Do I need that to printf to the PC? If so what pin does that connect to as I don't have a B3 pin on my particular package.

Here is the data sheet for my PIC (it is the one in the 20 pin DIP): http://ww1.microchip.com/downloads/en/DeviceDoc/39927c.pdf
If you can explain how to use the address finder code with this setup so it can printf to the PC that would be wonderful.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 2:51 pm     Reply with quote

Add the following #use rs232() line above main(). Choose an unused
i/o pin on your PIC for the Debug Monitor i/o. Edit the line below and
change both xmit and rcv to use your pin. (Same pin for both).

Connect pin 6 on the ICSP (ICD) connector on your board to the PIC pin
that you have chosen to use for Debug Monitor i/o. Pin 6 is shown as
the pin to use, on the diagrams on this page:
http://www.ccsinfo.com/faq.php?page=connect_icd

Code:
#use rs232(debugger, xmit=PIN_B3, rcv=PIN_B3)

//================================
void main()
{

printf("Start\n\r");
.
.
.

You will also have to enable the Debug Monitor in the CCS IDE.


Last edited by PCM programmer on Sat Apr 04, 2015 2:52 pm; edited 1 time in total
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 2:51 pm     Reply with quote

I have spent all day working on this and going through forums, from what I can tell my processor doesn't have a B3 pin but that is ok because you should be able to use any pin. This is the code I used with the program you sent me: #use rs232(debugger,xmit=PIN_b15,rcv=PIN_b15). I connected my 6th wire from my programmer to pin B_15 which is pin 18 on the DIP package. It compiled fine but none of the printf statements appeared on the monitor. I checked and monitor was disabled in CCS, so I enabled it and reloaded the code but still no luck. I cannot get anything to print to the monitor.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 2:53 pm     Reply with quote

Someone else who has the CCS IDE will have to help you beyond this point.
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 4:06 pm     Reply with quote

I have really given up on the ICD printf thing, back to the LCD problem, would it help if I posted my wave-forms? If anyone is familiar with i2C and/or this LCD maybe they can tell me if these waveforms make sense. Here is my waveform: http://postimg.org/image/pgcixayw1/ . As you can see the home made voltage level translator seems to be working just fine.

BTW I found the documentation for the I2C chip on the LCD module: http://www.nxp.com/documents/data_sheet/PCA8574_PCA8574A.pdf , it may also help. One thing I noticed is that it says it runs at 400kHz but when I move my cursor over the clock waveform it says 180Khz. I wonder if this is the problem?

Any thoughts?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 04, 2015 6:31 pm     Reply with quote

You never answered my question, long ago, to post a link to the website
for the product.

Is this the webpage for your lcd ?
https://www.dfrobot.com/wiki/index.php?title=I2C/TWI_LCD1602_Module_%28SKU:_DFR0063%29

Or is this it ?
http://www.dfrobot.com/wiki/index.php/I2C/TWI_LCD1602_Module_%28Gadgeteer_Compatible%29_%28SKU:_DFR0063%29

Or some other page ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19544

View user's profile Send private message

PostPosted: Sun Apr 05, 2015 3:21 am     Reply with quote

Answer PCM_Programmer's question. This is vital. I actually found three versions being advertised. If your's isn't like the two he shows, then post a photograph of it.

No the clock rate is not a problem. _Up to_ 400KHz. It would be a problem if the device was only rated for 100KHz max.

Found a picture of the other version mentioned:

<http://forum.arduino.cc/index.php?topic=158312.0>

Just like one of the ones PCM_Programmer, it too has address jumpers.

<http://arduino-info.wikispaces.com/LCD-Blue-I2C?responseToken=e3027dd9e673ee353141bf8c2429a9f0>

The only one that has address==0x20, is not the one that has the markings described. This has address==0x27 = 0x4E on the PIC.



Has the three original versions of this board. The description sounds like the second of these.

So in all four versions of this board all being sold under the same name, but with different PCB notations.
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sun Apr 05, 2015 6:33 am     Reply with quote

Here is my LCD:











I just tried using address 4E and still nothing is displayed
temtronic



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

View user's profile Send private message

PostPosted: Sun Apr 05, 2015 6:41 am     Reply with quote

hmmm... silly question....

Can you confirm it's wired up correctly ? Are you 100% sure I2C clock and data are connected to PIC properly ?

If it is, then PCMs I2C scanner program will find the module and it's address !

Jay
i26c2



Joined: 01 Apr 2015
Posts: 19

View user's profile Send private message

PostPosted: Sun Apr 05, 2015 11:05 am     Reply with quote

There is only one clock and pone data line for i2c from my pic they are the pins that are used in the code and the logic analyser shows data on them (whether or not it is correct data is another matter), so ya I would say they are connected correctly. Level translation is even working correctly from 3V to 5V.

When I run the scanner program nothing happens. I can't get anything to appear on the monitor. I tried several different pins on the PIC as debug pin none of them work. I enabled monitor but no luck. I even increased my voltage from 3 to 3.3 because I read that debug will not work below 3.1V but still no luck.
Ttelmah



Joined: 11 Mar 2010
Posts: 19544

View user's profile Send private message

PostPosted: Sun Apr 05, 2015 11:08 am     Reply with quote

You need the ground pin to be common as well.
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 Previous  1, 2, 3, 4, 5, 6  Next
Page 4 of 6

 
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