Pages: [1]   Go Down
Author Topic: How to get IM50240 LCD Library working (fixed)  (Read 1564 times)
0 Members and 1 Guest are viewing this topic.
canada
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Insert text here:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:

 #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
« Last Edit: January 03, 2009, 11:41:14 am by nigel_mck » Logged


SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6654
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is OptexLCD.h ?
Logged

canada
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Insert text here:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Nigel
Logged


London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6252
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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   :smiley
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.
« Last Edit: January 03, 2009, 10:01:51 am by mem » Logged

Bristol, UK
Offline Offline
Edison Member
*
Karma: 1
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

canada
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Insert text here:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh sorry smiley-razz
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 :smiley

I will post the exact errors in the next post

Thanks

Nigel
Logged


London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6252
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

« Last Edit: January 03, 2009, 11:06:58 am by mem » Logged

canada
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Insert text here:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6252
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

canada
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Insert text here:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

YOU ARE MY HERO!!!!!

Thanks

Nigel
Logged


SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6654
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: