View previous topic :: View next topic |
Author |
Message |
i26c2
Joined: 01 Apr 2015 Posts: 19
|
|
Posted: Sat Apr 04, 2015 12:45 pm |
|
|
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
|
|
|
i26c2
Joined: 01 Apr 2015 Posts: 19
|
|
Posted: Sat Apr 04, 2015 1:01 pm |
|
|
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
|
|
Posted: Sat Apr 04, 2015 1:12 pm |
|
|
Email the company and ask for the documentation. |
|
|
i26c2
Joined: 01 Apr 2015 Posts: 19
|
|
Posted: Sat Apr 04, 2015 1:20 pm |
|
|
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
|
|
Posted: Sat Apr 04, 2015 2:51 pm |
|
|
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
|
|
Posted: Sat Apr 04, 2015 2:51 pm |
|
|
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
|
|
Posted: Sat Apr 04, 2015 2:53 pm |
|
|
Someone else who has the CCS IDE will have to help you beyond this point. |
|
|
i26c2
Joined: 01 Apr 2015 Posts: 19
|
|
Posted: Sat Apr 04, 2015 4:06 pm |
|
|
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
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19544
|
|
Posted: Sun Apr 05, 2015 3:21 am |
|
|
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
|
|
Posted: Sun Apr 05, 2015 6:33 am |
|
|
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
|
|
Posted: Sun Apr 05, 2015 6:41 am |
|
|
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
|
|
Posted: Sun Apr 05, 2015 11:05 am |
|
|
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
|
|
Posted: Sun Apr 05, 2015 11:08 am |
|
|
You need the ground pin to be common as well. |
|
|
|