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.
10 years, 6 months ago.
foundpinmap not found error on LCD program
Hi, I'm trying to use Kyle Gilpin Menusystem program from this link http://circuitcellar.com/contests/nxpmbeddesignchallenge/winners/HM3915.htm with 16*2 LCD screen. I edited this line:
include the mbed library with this snippet
MenbedDisplayHD44780 *hd44780Lcd = new MenbedDisplayHD44780 (p15, p16, p17, p18, p19, p20, MenbedDisplayHD44780::LCD16x2);
It doesn't work and I have an error foundpinmap not in my hyperterminal.I would like to have answers to this problem.
The program:
include the mbed library with this snippet
#include "mbed.h" #include "menbed.h" AnalogIn photocell(p11); PwmOut led1(LED1); PwmOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); float photocellVoltage(void) {return 3.3 * photocell;} void setLed1Pwm (float d) {led1 = d / 100.0;} float getLed1Pwm (void) {return led1 * 100.0;} void setLed2Pwm (float d) {led2 = d / 100.0;} float getLed2Pwm (void) {return led2 * 100.0;} void toggleLed3 () {led3 = led3 ^ 1;} void lightLed4 () {led4 = 1;} void extinguishLed4 () {led4 = 0;} int main() { // Declare all the submenus so that they can be referenced in the // definitions of other menus MenbedMenu *rootMenu; MenbedMenu *measurementMenu; MenbedMenu *controlMenu; MenbedMenu *aboutMenu; // Root menu--to create a menu, we first create an array of pointers to // all the menu items that will populate the menu. The MenbedMenuItem // constructor take five arguments: the function to be executed when the // item is selected; the child menu to open when the item is selected; // a boolean indicating whether the child menu is actually this menu's // ancestor, (useful when creating "go to root menu" items); a parameter // object that holds a value to be viewed or modified; and a text string // indicating what the menu item should say. The text string may contain // a printf-style specifier for a float that is bracketed by \t characters // to offset it from the surrounding text. If the float specified is // found, it will be replaced by the value of the parameter. MenbedMenuItem *rootMenuItems[3] = { new MenbedMenuItem (NULL, &measurementMenu, false, NULL, "Measurements"), new MenbedMenuItem (NULL, &controlMenu, false, NULL, "Controls"), new MenbedMenuItem (NULL, &aboutMenu, false, NULL, "About"), }; // After we have the array of pointers to menu items, we pass the number of // elements in the arry and the array itself to the MenbedMenu constructor. rootMenu = new MenbedMenu (3, rootMenuItems); // Measurements menu--the first item of the measurement menu displays the // voltage and the resistor divider junction formed between a photocell and // a fixed resistor. To print this voltage as part of a menu item, we // create a MenbedMenuParam object that takes as arguments to its // constructor: a pointer to a function that returns a float containing the // value of the parameter; a pointer to a function that we would call to // change the value of the parameter; a boolean (irrevelant here) // indicating whether the parameter, if it were modifiable by the user, // should be updated as the user is changing its value or whether its // should only be updated after the user has confirmed the new value; a // minimum value for the parameter; a maximum value; and a step size. MenbedMenuParam photocellParam (photocellVoltage, NULL, false, 0.0, 0.0, 0.0); // Having created the parameter, we pass it as the 4th argument of the // MenbedMenuItem constructor. Note the \t-offset %.2f format specified // in the menu item text. The menu system will call the photocellVoltage // function specified in the parameter constructor above and then print the // float that it returns in place of the %.2f in the menu text. MenbedMenuItem *measurementMenuItems[2] = { new MenbedMenuItem (NULL, NULL, false, &photocellParam, "Photocell: \t%.2f\tV"), new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") }; measurementMenu = new MenbedMenu (2, measurementMenuItems); // Controls menu--We have modifiable parameters in the first and second // meu items of the controls menu. Walking through the first parameter // constructor, the getLed1Pwm function pointer points to a function that // returns the current value of the PWM duty cycle. The setLed1Pwm // function pointer points to a function which sets the PWM duty cycle. // The boolean set to true indicates that as soon as the user makes a // change to the parameter, the setLed1Pwm function will be called. The // menu system will not wait for the user to confirm his change before // making the call. The 0.0 and 100.0 represent the minimum and // maximum PWM values. The final 1.0 paramter is the step size when // changing the PWM duty cycle. MenbedMenuParam pwmParam1 (getLed1Pwm, setLed1Pwm, true, 0.0, 100.0, 1.0); // The only different in this parameter from the one above is that the PWM // duty cycle is not updated (setLed2Pwm is not called) until the user // confirms the new duty cycle. If the user cancels his modifications // (either by pushing the cancel button or pushing and holding the select // button) setLed2PWM is never called. MenbedMenuParam pwmParam2 (getLed2Pwm, setLed2Pwm, false, 0.0, 100.0, 1.0); // The third, fourth, and fifth items of the control menu demonstrate // functions when a menu item is selected. The ability to call a function // can be combined with either displaying a submenu or editing a parameter. MenbedMenuItem *controlMenuItems[6] = { new MenbedMenuItem (NULL, NULL, false, &pwmParam1, "LED1 PWM: \t%.0f\t%"), new MenbedMenuItem (NULL, NULL, false, &pwmParam2, "LED2 PWM: \t%.0f\t%"), new MenbedMenuItem (toggleLed3, NULL, false, NULL, "Toggle LED3"), new MenbedMenuItem (lightLed4, NULL, false, NULL, "Light LED4"), new MenbedMenuItem (extinguishLed4, NULL, false, NULL, "Extinguish LED4"), new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") }; controlMenu = new MenbedMenu (6, controlMenuItems); // About menu--there's nothing fancy here, but the lack of a "Home" item // forces the user to employ the cancel button, either directly or by // pushing and hold the select button, to return to the root menu. MenbedMenuItem *aboutMenuItems[3] = { new MenbedMenuItem (NULL, NULL, false, NULL, " NXP3915"), new MenbedMenuItem (NULL, NULL, false, NULL, " Copyright 2011"), new MenbedMenuItem (NULL, NULL, false, NULL, " xxxxxxxx@xxx.xxx") }; aboutMenu = new MenbedMenu (3, aboutMenuItems); // Having created the menus, menu items, and item parameters, we are ready // to instantiate the display. MenbedDisplayHD44780 extends MenbedDisplay // and implements the all-important writeLine function allong with some // other less important functions. The pins we pass to the constructor // specify the physical interface connection to the LCD. MenbedDisplayHD44780 *hd44780Lcd = new MenbedDisplayHD44780 (p15, p16, p17, p18, p19, p20, MenbedDisplayHD44780::LCD16x2); // Now, we have the menu objects and the display object. All we have to do // is create the menbed menu system. The number of buttons used by the // menu system is specified by the number of pins passed to the Menbed // constructor. The pin order is select, down, up, cancel. With // constructor overloading, we can opt out of using the cancel and up // buttons. /* Four buttons (select, down, up, cancel ) */ Menbed menbed(p22, p24, p23, p21, rootMenu, hd44780Lcd); /* Three buttons (select, down, up) */ /* Menbed menbed(p22, p24, p23, &rootMenu, hd44780Lcd); */ /* Two buttons (select, down) */ /* Menbed menbed(p22, p24, &rootMenu, hd44780Lcd); */ // The menu system runs in the background using Ticker objects. The user // can now run whatever application code he pleases. while(1) {} }
1 Answer
10 years, 6 months ago.
Hello,
I don't see the definition of MenbedDisplayHD44780 object shared. I would check the initialization parameters, if all are correctly defined. Because pinmap not found means the one of pins there are not available for desired functionality.
Regards,
0xc0170
you're right it was a problem of initialization.I forgot to correct the following line in menbedDisplayHD44780.h
include the mbed library with this snippet
MenbedDisplayHD44780 (PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDSize size = LCD16x2);
Thank you very much.
posted by 21 May 2014