Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 11 months ago.
interfacing with othe device
Dear All, I need to connect MBED with programmable power supply (PS) for getting feedback with the information of PS. and the PS has a baud rate 2400 bps. I try the program to communicate with PC and it okay, MBED respons to Teraterm with the character L what I want to. but how to display on LCD Display??
here the program
<<code>>
#include "mbed.h"
- include "TextLCD.h"
- define CMD_L (0x4C)
TextLCD lcd(p15, p16, p25, p26, p19, p20); rs, e, d4-d7
Serial device(p28, p27); tx, rx
int main() { device.baud(2400); lcd.printf("Starting...\n"); wait(5); lcd.cls(); while(5) {
wait(1); device.putc(CMD_L); "L"
lcd.printf("%s\r\n", device.getc());
} } <<\code>>
can some body help or suggestion?
thanks before..
1 Answer
11 years, 11 months ago.
What type of LCD do you have, look at the source to TextLCD.cpp it supports several LCD, the default is LCD16x2. Also do a locate to position your cursor. Sample:
lcd.cls(); lcd.locate(0,0); lcd.printf("Hello world"); lcd.locate(0,10); lcd.printf("%c X-axis: %02u.%03u sec",(position == HORZ) ? '#' : ' ' , xtime/1000, xtime % 1000 );
Also in your code does getc() return a int ? If so it should be printf("%c",device.get());