AnsweredAssumed Answered

processor expert, the mc9s08dz128mll and an 8bit 2x16 LCD

Question asked by GMVS on Nov 23, 2012
Latest reply on Nov 27, 2012 by GMVS

hi

 

this is the first time i use the freescale technology and i'm having a couple of problems getting used to the processor expert

 

right now i', trying to connect a NHD‐0216K1Z‐FL‐YBW LCD to it. i attach the datasheets. i checked out the components library for 8bit 2x16 LCD but theres nothing about it, so i have to make the code myself.

 

it really confuses me the amount of files the pe has generated for it so far

 

i selected port K for my databus and pe created

Byte1.h

Byte1.c

where Byte1.h has methods for the byte and bit direct manipulation

and Byte1.c has a lot of stuff i dont quite get. well i do know what they are (more or less): methods for the byte and bit masked manipulation. but i dont understand what to do with such a file. the includes are for .h, so if i ever wanted to use the other methods how would i do that? what are the .c files for?

 

then i used port H for the extra signals and again i got

Bits1.h

Bits1.c

same problem

 

 

this files contributed to my headache also while trying to write the code for the LCD

 

lets see for example

sendCommand(cmd) //method in LCD.h that i made

it calls for

Byte1_PutVal(cmd) //method in Byte1.h that processor expert made

which calls for

setReg8(PTKD, Val) //stuff in the library? dunno who made that...

 

those kind of names, Byte1_PutVal(cmd), are completely meaningless to me. if i were using all available ports

Byte3_PutVal(a)

Byte5_PutVal(c)

Byte1_PutVal(d)

Byte2_PutVal(b)...

what the hell am i doing??

that kind of code is unreadable.  aint' there a way to change such generic names for something like

 

 

 

 

PutPortH(a)

PutPortA(c)

PutPortK(d)

PutPortC(b)

or better yet

PutLCDControlLines(a)

PutMemory1Address(c)

PutLCDBus(d)

PutLEDsData(b)

and such?

 

this problem, with the bits is a bigger nightmare

i have 20 files named from Bit1 to Bit20

each time i want to set or cleat a bit pin i have to go through all the files to check which one is the one i need, because neither the file name nor the method name say anything about the ports they mess around with

 

another problem

the initLCD() routine i made needs a busy wait of some ms

what would be the best way to implement this?

 

at first i thought about a flag4ms: i'd clear the flag and do a while(!flag4ms); waiting for the flag to be turmed on inside a timer interrupt (never do this on multithread system), but the isr is in one file and the initLCD is in another: how do i make flag4ms global?

 

or what better way is there to make the busy wait?

i'd count uint i; for (i=0; i<65535;i++) but

i don't think thats valid

i don't know how much time would that be, but i'm working at 16MHz so i dont think its enough

 

if i could make flag4ms global i could use the same interrupt to debounce buttons and other stuff

 

 

please help

i'm really confused

 

 

 

 

but everything

Attachments

Outcomes