Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I2C 4x20 display with OTG and Micro
23-04-2012, 12:41 PM,
#21
RE: I2C 4x20 display with OTG and Micro
mf01:

Thanks!

Not sure how I was supposed to know about the stdout file but I was immediately able to solve the problem now that I know about it.

Just an innocuous delayMicroseconds problem.

In the page http://wiki.pinguino.cc/index.php/Category:Functions I found the function delayMicroseconds and used it without problems in my .pde file but it turns out that delayMicroseconds may not be addressable in my NHD.c file. I had to include delay.c and use Delayms function. As soon as I did that my separated code example works. Why is this?

There are still 2 warnings in the stdout that I can not figure out:
Code:
if exist C:\Pinguino32X.2\source\main32.o @del C:\Pinguino32X.2\source\main32.o
if exist C:\Pinguino32X.2\source\main32.elf @del C:\Pinguino32X.2\source\main32.elf
if exist C:\Pinguino32X.2\source\main32.hex @del C:\Pinguino32X.2\source\main32.hex
if exist C:\Pinguino32X.2\p32\obj\non-free\processor.o @del C:\Pinguino32X.2\p32\obj\non-free\processor.o
        1 file(s) copied.
C:\Pinguino32X.2\win32\p32\bin\mips-gcc.exe -EL -O3 -ffunction-sections -fdata-sections -Wl,--gc-sections -march=24kc -msoft-float -Wl,-LC:\Pinguino32X.2\p32\obj\non-free -Wl,--defsym,_min_heap_size=16384 -Wl,-Map=C:\Pinguino32X.2\source\output.map -D __PIC32MX__ -D __32MX440F256H__ -D PIC32_PINGUINO_MICRO -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\procdefs.ld -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\elf32pic32mx.x -LC:\Pinguino32X.2\p32\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\Pinguino32X.2\p32\include\non-free -IC:\Pinguino32X.2\p32\include\pinguino\core -IC:\Pinguino32X.2\p32\include\pinguino\libraries -IC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO -IC:\Pinguino32X.2\Dale\NHD -IC:\Pinguino32X.2\p32\obj\non-free -o C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.c \
        C:\Pinguino32X.2\p32\obj\non-free\crt0.S \
        C:\Pinguino32X.2\p32\obj\non-free\processor.o \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libcdc.a \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libadb.a \
        C:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\ISRwrapper.S \
        C:\Pinguino32X.2\p32\include\non-free\p32xxxx.h \
        -lm -lgcc -lc
In file included from C:\Pinguino32X.2\source\main32.c:32:0:
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: 'struct stat' declared inside parameter list
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: its scope is only this definition or declaration, which is probably not what you want
C:\Pinguino32X.2\win32\p32\bin\mips-objcopy.exe -O ihex C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.hex
copy C:\Pinguino32X.2\source\main32.hex C:\Pinguino32X.2\source\main32tmp.hex  
        1 file(s) copied.

John:

Thanks!

I had tried both <> and "" on my includes previously and found no difference. I have been putting my NHD.c file in the same directory as the .pde file and it always seems to find it. I now have on my 'to do' list a note to further research the difference between <> and "".

I would love to be able to read up on C, where? I have been using the Pinguino site a lot for reference, trying to learn the 'Pinguino language' that is mentioned on the home page. That is the only C based language I really need to learn right now.



AND, I just noticed that my program does not seem to survive removing of the USB from the MICRO board, when I plug the Micro back in my 'Hello World' does not return until I re-upload the code, any hints?

Dale
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
23-04-2012, 01:15 PM, (This post was last modified: 23-04-2012, 01:42 PM by mf01.)
#22
RE: I2C 4x20 display with OTG and Micro
Hi Dale,

re stdout you could always read http://forum.pinguino.cc/announcements.php?aid=1 or any one of the other such announcements littered around the forum including http://forum.pinguino.cc/forumdisplay.php?fid=32 Big Grin

Re the " warning: 'struct stat'" I too get that but I have never gotten round to figuring out the cause as it does not seem to have stopped anything from running as expected to date.

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
23-04-2012, 02:16 PM, (This post was last modified: 23-04-2012, 02:40 PM by KiloOne.)
#23
RE: I2C 4x20 display with OTG and Micro
Wow, I'm sorry. Now there is an example of reading and thinking I read it when I obviously did not, as I have read that post many times because I always want to make sure I don't post stupid questions.

Maybe it would help to put the first line in bold 18pnt Blush

Thanks,
Dale

This may be another dah moment but in answer to my own question, it looks like you have to delay a 1/2 second or so before you call I2C_init or the i2c won't initialize on power up, sorry if I missed that point somewhere. Smile again!
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
23-04-2012, 05:48 PM,
#24
RE: I2C 4x20 display with OTG and Micro
If you need a 1/2 sec delay it sounds like some hardware is either still powering up or has firmware that is still getting going. The PIC32 by contrast runs very quickly once it has enough volts!!

On the include file, it sounds like the IDE preprocesses rather simplistically.

John
Reply
06-05-2012, 01:41 PM, (This post was last modified: 06-05-2012, 02:19 PM by KiloOne.)
#25
RE: I2C 4x20 display with OTG and Micro
I ended up being able to take the delay out.

Here is a Hello World program, with necessary nhdr1.c include file that will should get anyone up and running with a 4x20 Newhaven display connected to any Pinguino Uext connector as per this connection drawing:
   

Since I am the only one who has done this so far AND if you try my code, please reply to this post to let me know whether it all worked for you!!! Smile

Please read comments in both files as there are some things you can adjust in both files if you have troubles.

Thanks,
Dale


Attached Files
.pde   NHD-HelloWorld.pde (Size: 1.37 KB / Downloads: 18)
.c   nhdr1.c (Size: 9.48 KB / Downloads: 14)
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
21-10-2014, 01:38 PM,
#26
RE: I2C 4x20 display with OTG and Micro
Hi,

In this detailed program the lcd.printf doesn't work, if the "OnTimer1(" line is uncommented.

Code:
int c=0;

void cntr(){
      c++;
}

void setup() {
   //run once:
   // initialize the library with the numbers of the interface pins
   //lcd.pins(RS, E, D4, D5, D6, D7, 0, 0, 0, 0); //4bits
   //lcd.pins(RS, E, D0, D1, D2, D3, D4, D5, D6, D7); //8bits
   lcd.pins(0, 1, 2, 3, 4, 5, 0, 0, 0, 0); // RS, E, D4 ~ D8    

   // set up the LCD's number of columns and rows:
   lcd.begin(16, 4);
   lcd.setCursor(0, 1);
   lcd.print("Start");
   OnTimer1(cntr,INT_MILLISEC,300);  
   }

void loop() {
   lcd.setCursor(0, 1);
   lcd.printf("%d",c);
   delay(500);
}

Doesn't work another example (i.e. ...\examples\07.Display\LiquidCrystal\clock.pde) as well.

I use:
Win7 64bits
18F2550 + 20MHz
bootloader4550V2-12.hex
IDE X.4 999
python-3.4.2.amd64

I checked in the IDE the right bootloader v2.x. and the right PIC...

Any idea?

Best regards: Attila
Reply
22-10-2014, 04:11 PM,
#27
RE: I2C 4x20 display with OTG and Micro
Hi,
I tried your example without problem but my config is :
  • Linux Debian 64-bit
  • Pinguino IDE v11
  • Bootloader v4.14
  • Pinguino 45k50
You might try the v11 for Windows.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
24-10-2014, 05:10 PM,
#28
RE: I2C 4x20 display with OTG and Micro
(22-10-2014, 04:11 PM)regis Wrote: Hi,
I tried your example without problem but my config is :

  • Linux Debian 64-bit
  • Pinguino IDE v11
  • Bootloader v4.14
  • Pinguino 45k50
You might try the v11 for Windows.

Hi,

I tried your suggestion, but doesn't work. The script begin running, and I can see the followin:
Downloading packages ...

 100% [================================================]

 Installing packages ...

And it is all! Endless waiting.

I tested it (at home) on Ubuntu 14.04, AMD 64

Have you a suggestion for me?

Thanks...

Regards: Attila
Reply
25-10-2014, 12:31 AM,
#29
RE: I2C 4x20 display with OTG and Micro
You tried the Windows version on Linux? That won't work.

The idea was to try the Windows version on Windows.

John
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)