Dependents: vmConfort_v6 Programski_zadatak_23 Projektni_zadatak_23 tempivolt
Diff: Display1602.h
- Revision:
- 1:fc4c861451e1
- Parent:
- 0:6c0e68e0d876
--- a/Display1602.h Fri Apr 06 19:22:15 2012 +0000 +++ b/Display1602.h Sun Apr 08 12:51:51 2012 +0000 @@ -46,7 +46,7 @@ */ -/* +/** Basic bit of code for using a standard 1602 display in 8 bit mode. * Written by Richard e Collins. * Basic bit of code for using a standard 1602 display in 8 bit mode. * When wiring one of these displays up make sure the power to the LCD on pin 3 is correct, too high and it will not display anything. About 0.2v is good, I use a POT to set it. @@ -58,21 +58,40 @@ */ struct Display1602 { + /** + * Constructor, here you state the oins used to read and write data on and the control pins. + * @param registerSelect This is the pin used to select if you are sending data or setting a control register. + * @param readWriteSelect The pin to state if you are reading or writing data / register. + * @param d0 -> d7. The eight pins for the data to be either written to the display or a register. + */ Display1602(PinName registerSelect,PinName readWriteSelect,PinName readWriteEnable,PinName d0,PinName d1,PinName d2,PinName d3,PinName d4,PinName d5,PinName d6,PinName d7) ; - + + /** + * Clears the display. + */ void Clear(); + /** + * Prints the text to the display, will limit the chars read by 16 chars or hitting a null terminator, which ever comes first. + * Advances the cursor pos. + */ void Print(const char *text); + /** + * handy printf funtion for displaying text. + * Advances the cursor pos. + */ void printf(const char *format,...); + /** + *Sets the cusor X Y pos. + */ void SetXY(int x,int y); private: DigitalOut rs; //Register select, high value in data is data char data, when low is a command. DigitalOut rw; //Data direction, high read operation, low is write operation. DigitalOut e; //When high the value in data is read from or written to the register selected. - DigitalOut bf; //Used by the hardware to say when busy, this is also data bit 7. I am assuming it is only valid to read when readWriteEnable is false. BusOut data; //The data sent. void SendCommand(int cmd);