8051 game project
To write a custom char into CGRAM, I need first to send the command 0x40 so that the custom char is written into 1st position of CGRAM.
Then we just need to send, code by code for each of the 8 lines of each position in CGRAM.
But is it possible to write directly into any other position rather than the 1st??? For instance, I already used all 8 available custom chars and I can discard last 2 positions and write there 2 new ones.
I'm trying to do this by first send the command 0x46, then send the 8 codes for that position, then I send the command for the last position 0x47 and lastly I send the 8 codes for last position but it is not writing what I want where I want...
The code is attached.
Edited;
Also solved!
[ Edited Tue Feb 17 2015, 06:22 pm ]
http://www.8051projects.net/lcd-interfacing/lcd-custom-character.php
Basically CGRAM characters start at addresses 8 bytes apart.
The command for the first is 0x40 ,for the second is 0x48,
and for the last is 0x78.
[ Edited Tue Feb 17 2015, 07:17 pm ]
The CGRAM addresses for each character are mention in a table on this page:
http://www.8051projects.net/lcd-interfacing/lcd-custom-character.php
Just add 0x40 to get the address of character you know to create.
Anyway, now I'm trying to find a way to create motion by moving my chars 1 bit to the right or to the left using bitshifting but I still couldn't work out a way yet! Any tips are welcome!
Thanks
Psy
I've already read that tutorial and almost all other tutos from that section. It helped me a lot but some issues that were not covered in those tutos.
PsySc0rpi0n
I would really like to know about this
Anyway, now I'm trying to find a way to create motion by moving my chars 1 bit to the right or to the left using bitshifting but I still couldn't work out a way yet! Any tips are welcome!
PsySc0rpi0n
There is no better way than creating a buffer, manipulate it and then write to CGRAM. This way you can keep track of data you're modifying. The only thing to keep in mind is you can only have 8 characters. If you can provide some idea on what kind of movement you want, is it related to only 1 character or all 8 then I can provide better solution.
I've already read that tutorial and almost all other tutos from that section. It helped me a lot but some issues that were not covered in those tutos.
PsySc0rpi0n
I would really like to know about thisajay_bhargav
Details as real timings to make the code work in real hardware or even the fact that the CGRAM chars are automatically updated in DDRAM if they are changed in CGRAM. And some other details I can't remember now!
[quote]
Anyway, now I'm trying to find a way to create motion by moving my chars 1 bit to the right or to the left using bitshifting but I still couldn't work out a way yet! Any tips are welcome!
PsySc0rpi0n
There is no better way than creating a buffer, manipulate it and then write to CGRAM. This way you can keep track of data you're modifying. The only thing to keep in mind is you can only have 8 characters. If you can provide some idea on what kind of movement you want, is it related to only 1 character or all 8 then I can provide better solution.ajay_bhargav
I'm talking about to slide any char to the right or to the left in the LCD but bit by bit and not char by char.
And yes, chars that are made by multimple single CGRAM chars. If only 8 are available, well, so be it!
Now exiting thing here is you dont have to write to DDRAM all those 8 characters every time. Once the character is displayed on DDRAM, and if CGRAM content is changed, it will be reflected on DDRAM automatically. So once you have displayed CGRAM characters, you only have to modify CGRAM content to give a moving look.