Go Down

Topic: How to get IM50240 LCD Library working (fixed) (Read 1 time) previous topic - next topic

nigel_mck

Jan 03, 2009, 12:16 am Last Edit: Jan 03, 2009, 05:41 pm by nigel_mck Reason: 1
Code: [Select]

#include <OptrexLCD.h>
#include <MsTimer2.h>

// This example displays an unsigned counter, starting from 2000,
// incrementing it with each LCD refresh (this is not too fast).
// Additionally, it will alternate with showing the word "Clear",
// then "Secure", and then both, and finally neither of those
// words (at the left of the display).
//
// Before running this, either wire the OptrexLCD IM50240
// (PWB50240-CEM) to the pins shown below, or modify the pin
// assignments to match your own wiring. The Optrex LCD
// wiring is documented in OptrexLCD.h
//
// Note that the MsTimer2 used by this driver, uses timer 2

void
setup(void) {
 /*
  * Change these to your own ATmega168 I/O pin preferences, if necessary :
  * (The values shown are the defaults ATmega168 I/O pin numbers)
  */
 OptrexLCD::set_M_pin(2);        // Wired to 50% duty cycle clock (M), pin 4 on LCD PCB
 OptrexLCD::set_Shift_pin(3);    // Wired to Shift clock,              pin 3 on LCD PCB
 OptrexLCD::set_Latch_pin(7);    // Wired to Latch clock,              pin 2 on LCD PCB
 OptrexLCD::set_Din_pin(10);     // Wired to Input data,               pin 1 on LCD PCB

 OptrexLCD::initialize();        // Start the OptrexLCD driver
}

void loop() {
 unsigned counter = 2000;              // Arbitrarily start our counter at 2000

 for(;;) {                             // Repeat forever, using our counter above..
   OptrexLCD::wait_latched();          // Block until a LCD latch event occurs (1 refresh)
   OptrexLCD::write_uint(counter++);   // Convert counter to 4 digits and display that until further notice

   switch ( counter % 4 ) {            // Calculate a remainder, and use that to...
   case 0 :                            // Show "CLEAR" but not "SECURE"
     OptrexLCD::set_clear(true);
     OptrexLCD::set_secure(false);
     break;
   case 1 :                            // Don't show "CLEAR", but show "SECURE"
     OptrexLCD::set_clear(false);
     OptrexLCD::set_secure(true);
     break;
   case 2 :                            // Show both "CLEAR" and "SECURE"
     OptrexLCD::set_clear(true);
     OptrexLCD::set_secure(true);
     break;
   case 3 :                            // Don't show "CLEAR" or "SECURE"
     OptrexLCD::set_clear(false);
     OptrexLCD::set_secure(false);
   }
 }
}

// End OptrexLCD driver example





Can anyone tell me whats wrong with this code? It says Im missing some "()"?

If you need more detail to help me just post.

Thanks

Nigel

westfw


nigel_mck

Its located in:
C:\Documents and Settings\Nigel\My Documents\Stuff\arduino-0012-win\arduino-0012\hardware\libraries

Nigel

mem

#3
Jan 03, 2009, 04:01 pm Last Edit: Jan 03, 2009, 04:01 pm by mem Reason: 1
Nigel, there was no smiley after your post so I will assume you weren't being sarcastic

That location is on your machine and you haven't given us access to it   ::)
It will be easier for us to help you if you post a link to a public address that has the files you are trying to compile.

Anachrocomputer

Quote
It says Im missing some "()"?


What line number in what file did it give that error?  And can you please post the exact wording of the error message?

nigel_mck

Oh sorry :P
You can find the files here:
http://www.arduino.cc/playground/Code/LCD

Look for:
Optrex IM050240 Serial LCD Driver (PCB marked with PWB50240-CEM). These

Haha I sorta mis-interpreted your post ::)

I will post the exact errors in the next post

Thanks

Nigel

mem

#6
Jan 03, 2009, 05:03 pm Last Edit: Jan 03, 2009, 05:06 pm by mem Reason: 1
Its not really a problem with the code, its some pesky arduino macros that were recently introduced.

you can get the code to compile if you make the following changes to OptrexLCD.h

comment out this line as follows:
//#include <wiring.h>

and add in this line
#include <WProgram.h>

Good luck!


nigel_mck

Im trying to compile the code from the first post
Heres the errors Im getting:

To cool for typing it all out cause it wont paste, so click on the link 8-) :
http://picasaweb.google.com/HELLOwhereiseveryone/Screenshot#

You can zoom in with the magnifing glass in the upper right hand corner.

Nigel

mem

did you change OptrexLCD.h as per my previous post?

nigel_mck

mem, I did what you said and it works perfectly!!!

YOU ARE MY HERO!!!!!

Thanks

Nigel

westfw

Quote
You can find the files here:
http://www.arduino.cc/playground/Code/LCD

Interesting.  A search for "Optrexlcd" from the main arduino page does not find "optrexlcd.zip" in the playground!

Go Up