Products for USB Sensing and Control
It is currently Tue May 21, 2013 11:01 pm

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Jul 12, 2012 7:34 am 
Offline
Phidgetly

Joined: Thu Oct 21, 2010 5:22 pm
Posts: 31
Hi,

I just bought a PhidgetTextLCD Display 20x2 and want to write an ANSI C program in the PhidgetSCB2 to allow me to write texts in the PhidgetTextLCD. I have the PhidgetSBC2 connected to PhidgetTextLCD via USB. I found an example program for the LCD (TextLCD-simple.c) in your corporate website in "Programming Resource" (phidget21-c-examples_2.1.8.20120514.tar.gz).

When I complie the programing, I get the following error.

root@xter:/usr/uCLCD# gcc x.c -lphidget21
x.c: In function 'display_properties':
x.c:53: warning: passing argument 2 of 'CPhidget_getDeviceID' from incompatible pointer type
/usr/include/phidget21.h:122: note: expected 'enum CPhidget_DeviceID *' but argument is of type 'enum CPhidget_DeviceClass **'
x.c:64: warning: comparison between pointer and integer
root@xter:/usr/uCLCD#

I have not amended the program in any shape or form except for renaming it from "TextLCD-simple.c" to "x.c"

I have attached the "x.c" file in this post.

Is there anything wrong I am doing that I might have blind sighted? Thanks.


Attachments:
x.c [5.47 KiB]
Downloaded 36 times
Top
 Profile Send private message  
 
PostPosted: Thu Jul 12, 2012 8:50 am 
Offline
Engineering

Joined: Thu Nov 19, 2009 4:41 pm
Posts: 184
Yes there was a typo in our sample code.

You can fix the problem by replacing
Code:
CPhidget_DeviceClass *name;

with
Code:
CPhidget_DeviceID name;

in the display properties function.

Thanks for identifying the problem.


Top
 Profile Send private message  
 
PostPosted: Thu Jul 12, 2012 9:17 am 
Offline
Phidgetly

Joined: Thu Oct 21, 2010 5:22 pm
Posts: 31
Hi Fraser,

Thanks for your prompt reply. I have made the changes but I still get one more warning. The warning is as shown below.

root@xter:/usr/uCLCD# gcc x.c -lphidget21
x.c: In function 'display_properties':
x.c:53: warning: passing argument 2 of 'CPhidget_getDeviceID' from incompatible pointer type
/usr/include/phidget21.h:122: note: expected 'enum CPhidget_DeviceID *' but argument is of type 'enum CPhidget_DeviceClass *'
root@xter:/usr/uCLCD#

I have attached the modified "x.c" code.

Thanks.


Attachments:
x.c [5.47 KiB]
Downloaded 38 times
Top
 Profile Send private message  
 
PostPosted: Thu Jul 12, 2012 10:51 am 
Offline
Engineering

Joined: Thu Nov 19, 2009 4:41 pm
Posts: 184
make sure you use CPhidget_DeviceID not CPhidget_DeviceClass as well as remove the * from name


Top
 Profile Send private message  
 
PostPosted: Thu Jul 12, 2012 12:55 pm 
Offline
Phidgetly

Joined: Thu Oct 21, 2010 5:22 pm
Posts: 31
Oops! My bad as soon as I changed "CPhidget_DeviceClass" to "CPhidget_DeviceID", worked like a charm.

Thanks a bunch! :D


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group