![]() |
WPILib & LCD Display
We're trying to use just WPILib to display a character on an LCD screen through a TX port on a Vex processor.
We aren't having too much luck with making it happen with just these functions that WPILib gives us: Code:
unsigned char ReadSerialPortOne(void);Code:
#define BAUD_4800 0x0081It seems like there should be a way to use the functions in WPILib to output a character (and later a string of characters) to an LCD display serially. Is it possible? |
Re: WPILib & LCD Display
WriteSerialPortOne and WriteSerialPortTwo should write a single character to the first and second serial ports respectively. To write a null-terminated string to the first serial port, you could use a function such as
Code:
void puts(char *str)It seems like you probably could have figured this yourself, though, so let me know if I've misinterpreted your question. --Ryan |
Re: WPILib & LCD Display
Here's the code we had first tried using to output "h" onto the serial lcd display, but we had no luck with it.
Code:
#include "API.h"Using your suggestion, we've modified the code to the following, but we're still getting nothing. Here is our use of your code (we changed "puts" to "putsd" because of an error message): Code:
#include "API.h" |
Re: WPILib & LCD Display
Quote:
|
Re: WPILib & LCD Display
Quote:
|
Re: WPILib & LCD Display
Are you initializing the LCD driver chip properly? The ones I have used needed to be prodded a bit before they would display characters.
|
Re: WPILib & LCD Display
Quote:
Quote:
This is the LCD screen we're using, just a standard HD44780 controller. |
Re: WPILib & LCD Display
CHeck the Arduino source code, they have a library for character LCD's
|
Re: WPILib & LCD Display
I'm working with aseligman on this issue. We eventually got the WPILib to output display to the SparkFun SerLCD display. We did use OpenSerialPortTwo(BAUD_9600); and then WriteSerialPortTwo('w');
For some reason, it wasn't working with an earlier project. But we noticed that we couldn't get output to go to the terminal either. So, we looked up an old project that did output to the terminal and when we added the above lines of code, we were able to write to the LCD display. On a side note, we just tried to create a new project and the new project will not printf to the terminal. So, there is still something wrong- maybe with our MPLAB configuration? Project configuration? Not sure. Regardless, our old project is working fine, so we'll try to isolate the problem. Thanks for all the ideas. |
Re: serial out and printf with WPILib
Ok, another interesting discovery today. After much trial and error, we figured out why outputting to the serial port only worked sometimes. Actually, we never figured out why, we merely figured out how to get output consistently. For some reason, we had to have some kind of delay at the beginning of our program. This is really strange because we had the output looping and it did not work.
Anyway, by adding a Wait(1000) statement at the beginning of the code, we were able to get printf to the terminal and serial output to the SparkFun SerLCD display consistently. After we discovered this little trick, we then stumbled across a chiefdelphi thread that came to the same conclusion: http://www.chiefdelphi.com/forums/sh...ad.php?t=62384 Interestingly, the thread also said that they couldn't get printf to work with WPILib when they had a function other than main(). We may experiment with that a bit more another day. However, I'm hoping that this info is helpful to anyone else having problems using printf or serial out with WPILib. Because if you can get it to work, than you can have a nice inexpensive serial LCD display for your vex (http://www.sparkfun.com/commerce/pro...ducts_id=9393). |
| All times are GMT -5. The time now is 03:33. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi