1) try snd_char('A');
in C, "A" is a single-character string, 'A' is a character.
2) when the LCD powers up, it always fills up the first row with black blocks, until the LCD is initialized. it sounds like your LCD may be organized such that the first 8 characters are the "first row" and the second 8 characters are the "second row"... rather weird, but who knows. try putting in an endless loop to see if the other locations get filled eventually... I believe 0x40 is the address for the first char of the second row in most LCD's, so if you keep printing characters it should eventually get to that location. if it does fill it eventually, then you'll just have to access the LCD as if it were 2 rows instead of one.
looking over some LCD stuff today, it turns out my suspicion might be correct...
look at the table near the middle of https://www.myke.com/lcd.htm
according to that, for some 1x16 LCD's, the 9th character position is in fact at memory address 0x40, normally the second row of 2-row LCD's. so try moving the cursor to address 0x40 and you should be able to write to the rest of your row.
Strange, I infact tried writing to '0xC0', but I'll try again. That's 0x80 + 0x40...
I'll also try writing to 0x89, see which works...I think 0x89 would work if it *had* the support chip.
Thanks a lot, I'll try that function for sending strings to it. Need to see how to incorporate the 'send 8 chars', shift to 0xc0, 'send the balance' as well.
We did this last month in my microcontrollers class...which compiler are you using? Hopefully something better than the CCS-pic compiler.
But anyhoo, writing a 0x80 should put the cursor to the first char. in the first line and 0xC0 should go to the second line.
Also, how are you initializing the lcd?
you just have to keep track of the current cursor position whenever it changes, and have a couple IF statements scattered around as needed to handle shifting back and forth between 0x00-0x07 and 0x40-0x47... for instance if you just wrote a character to 0x07, you would tell the LCD to move the cursor to 0x40, and update your cursor position variable to match.
I now know why my command of 0xc0 didn't work. I didn't wait 5Ms, for the instruction to complete (as I am *not* polling the busy flag) - will let you guys know in a couple hours
LCD Init: in 4-bit mode, connected to a shift register for 3-wire mode, therefore initialised in 4-bit mode and data is sent to the SR as two nibbles, upper first, lower after. The status of 'R/S' is loaded before the data for each nibble to notify the LCD if it is a command or character.
instead of trying to adjust the string so that it is centered (with white spaces on either side), why not just calculate where you need to put the cursor to get it centered then just use a simple instruction write to the LCD?
seems like it'd be alot easier that way.
Of course! Ta, I think my brain had reached its limit at that point, and it was 2pm and I hadn't even had bfast
Will give it a shot later on
Also the LCD I have is a 1x16 with no LEDs actually soldered on. The spots for LEDs to be soldered on are there - but should I just bend some LEDs over and solder 'em in, or do special '90 degree SMDs' or something go there?
I'm thinking some 3mm's bent would do the job, and ultrabrights too