Identifier is undefined error in keil - Page 1
Forum section: electronics / general

author: dizgah
author_rank: Regular Contributor
timestamp: November 16, 2014, 06:59:24 am
content: hi every oneas i said past im trying to port osama GLCD library to keil for using with stm32f103 mcui am using prevlet variable in a glcd_putchar function but keil shows :Quote& its while that im declare this variale as global variableCode:unsigned char prevLet = 193;is there any one for helping me?i attached source code too & thanks

author: miguelvp
author_rank: Super Contributor
timestamp: November 16, 2014, 07:04:39 am
content: Quote from: dizgah on November 16, 2014, 06:59:24 amprevLet is not the same as prevlet you used lowercase l somewhere instead of L.Also next time attach the code in here it does accepts zips under attachments and other options right under where you type your message.I didn't look at your code because filetolink wants me to sign in via google, facebook or yahoo and of course I won't do that even if I had one of those accounts.

author: dizgah
author_rank: Regular Contributor
timestamp: November 16, 2014, 07:33:13 am
content: tnks for your answerboth of them areQuote& differences was about my typing faulti attached it again(becouse forum dose not accept .rar format & zip format will be more than 1MB i compress in zip & then zip the rar file )

author: miguelvp
author_rank: Super Contributor
timestamp: November 16, 2014, 07:55:29 am
content: Seems to me the problem is in font.hprevLet in glcd.h is the frist statement after that include and other defines and inside font.h you have some control characters within the file and the compiler thinks the file ends early because of those control characters.Any reason you have to leave those control characters within the file instead of just a description?I mean you can just put the letters BEL for character 7 instead of the actual bell control character in the source.Or SUB in line 30 (where it complains) instead of the actual 0x1a control character in the comment at the end of line 30.Code:compiling main.c.....\lib\font.h(30): warning: #1-D: last line of file ends without a newline..\lib\font.h(1): error: #37: the #endif for this directive is missing#ifndef Font_Lib..\lib\glcd.h(45): error: #29: expected an expressionunsigned char prevLet = 193;..\lib\glcd.h(45): error: #67: expected a "}"unsigned char prevLet = 193;..\lib\glcd.h(688): error: #20: identifier "prevLet" is undefinedif((c >= 193) && (prevLet >= 193) && (map[prevLet-193]) && (map[c-193]))..\lib\glcd.h(688): error: #20: identifier "map" is undefinedif((c >= 193) && (prevLet >= 193) && (map[prevLet-193]) && (map[c-193]))..\lib\glcd.h(759): error: #20: identifier "prevLet" is undefinedprevLet = 193;..\lib\main.c: 1 warning, 6 errors".\gpio.axf" - 6 Error(s), 1 Warning(s).

author: dizgah
author_rank: Regular Contributor
timestamp: November 16, 2014, 08:38:33 am
content: Quote from: miguelvp on November 16, 2014, 07:55:29 amreally thanks dear miguelvpit seems you are rightthe reason i ignoring these warning are i think they are comment & compiler dosent attention to comment(altough im confused how comment can do error :? )--------i cant find thanks button,where is it ?--------tnks again, i will come back soon with sack of new errors & warnings ; )

author: miguelvp
author_rank: Super Contributor
timestamp: November 16, 2014, 08:40:48 am
content: It's not the comments doing errors, those are special control characters that don't belong in the source code, it doesn't matter if they are in the comments or not, but they are going to throw the compiler off.

author: dizgah
author_rank: Regular Contributor
timestamp: November 16, 2014, 02:41:18 pm
content: hi againhere i have a new error tooQuote&Quoteits as ,i used #ifndef # def preprocessor instructions & dont know reason of this error,i attached my program in keil & hope some body help me in doing thistnks again

author: Jeroen3
author_rank: Super Contributor
timestamp: November 16, 2014, 04:16:23 pm
content: That is because font is defined and initialized in GLCD.h. This wayfontwill be inside the scope of the C file where #include "GLCD.h" is processed first.Note that the header guards are not working in the scope of the next C file. They are there to prevent header include loops.Move the definition of font to the C file, and use "extern const unsigned char font[]" inside the header. That is, if you want it to be public.It probably doesn't need to be public, since it's for the GLCD lib itself, put it at the top of GLCD.c and don't put it in the header.You can force it to throw an error when it is externally linked by puttingstaticin front. This also applies to functions.Same goes formap.

author: dizgah
author_rank: Regular Contributor
timestamp: November 17, 2014, 12:40:59 pm
content: hi every body againthanks Jeroen3----------------i eliminated all of errors,program compiled correctly but it dosent affect on lcd(lcd dosent show any thing)i debug it in keil & it seems instructions dosent affect to gpio ,for example gpio_config or setbit/reset bit & others dosent work (i dont see change in GPIOC debugging section)ex cuse me but can any one please see code & help me again ?WBR

author: Jeroen3
author_rank: Super Contributor
timestamp: November 17, 2014, 01:32:10 pm
content: Verify with a oscilloscope or logic analyzer that:- you have configured the GPIO, and pin multiplexers correctly. And power/clock to gpio blocks obviously.- the EN signal is emitted with the correct timing (those displays are slow)

author: dizgah
author_rank: Regular Contributor
timestamp: November 17, 2014, 02:01:18 pm
content: Quote from: Jeroen3 on November 17, 2014, 01:32:10 pmthank Jeroen3i dosent have oscope or logic analyzerany way i see it dosent work correctly in keil debugging/simulating sectiontiming is correct too becouse this library work fine in avr & codevision & even avrgcci want to know gpio instructions work correctly becouse im doubt it

author: Jeroen3
author_rank: Super Contributor
timestamp: November 17, 2014, 02:43:38 pm
content: QuoteAn STM32F1 is faster than an AVR. Much faster.I am not aware of actual simulation features in Keil, I do know the debug mode. Did you try to step through the code in debug mode and measure with your DMM what the IO state is?You can also put LED's on the bus and put a breakpoint in you trigger function.A Saleae logic analyzer clone can be bought for under $30.

author: dizgah
author_rank: Regular Contributor
timestamp: November 17, 2014, 03:35:54 pm
content: Quote from: Jeroen3 on November 17, 2014, 02:43:38 pmabout timing i mean parameters are same for example i used 1us delay as used in avr libDMM ? whats meaning of it ?LED is a good solution i will do itthanks

author: Jeroen3
author_rank: Super Contributor
timestamp: November 19, 2014, 06:54:39 am
content: 1 us is only enough to do a bus read operation.The fastest write commands available are all 38 micro seconds (us) in execution time. During that, the LCD won't respond.The slowest command is the Clear Display, with 1.5 milliseconds (ms).1 us is the value for the EN pulse with, which is allowed to be as low as 250 nanoseconds (ns).A delay of 250 ns on the chip does not mean a 250 ns pulse width on the other side of the bus cable.*values taken from typical hd44780 2x16 display datasheet I've used*