pacomms
United Kingdom
Asked
— Edited
So i have bought an I2C display and controller for my robot, the ebay link is http://www.ebay.co.uk/itm/310246198837?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649 , i can get the display to power up but cant get any characters to display on it, the default address is 0x42 so i am sending the following via a script
I2CStart() I2CWrites(0x42, "Test") I2CStop()
nothing happens, there is a link to a datasheet on the ebay page but i am a total noob with I2C, i get the idea but not sure what im doing wrong, the only thing i noticed is that on the ezb board the I2c interface is listed as SDA and SCL but on my display and controller that comes with it its listed as SCK and SDA ? have i gone and bought the wrong thing ?
Thanks Kurt
0x42 is the 7 bit address. Read This
hmm im not sure i understand that, how does 0x09 x 2 become 0x12 ? please forgive my daft question but im new to I2c etc etc, what would 0x42 be as an 8 bit address ?
Thanks Kurt
I can't explain any different than the link I sent you too Read that link. If you need to understand more about binary, then google has your answers. Other than that, once you get it... It'll be a eureka moment. Then you'll laugh about how easy it was to understand
Ok so either i am really thick here or im missing something big time, i dont understand how i would work out what the binary is for 0x42 , do i just ignore the 0x and work on the 42 ? if i work out the binary for that ? how do i then move it over 1 or x it by 2, surely that just makes 84, sorry if this is really dumb questions but i have never ever worked with binary b4, i just need to know what address to use for my display .. 0x42 is the address given, so its 7 bit i get that it needs to be 8 bit, there must be an easy way to work out this i know its probably really really easy but, from your table on what bit = what value ie 10000001 is 129 but thats an eight bit number already, so if i have 0x42 which im taking 42 as the bit im interested in, if its 7 bit then .......... o god my head hurts, damn display why cant it just have an eight bit address in the manual lol
Thanks Kurt
Yup... 0x just means that the number after the 0x is hex. If you just said 42, no one would know if it is hex or not. So hex is defined by the 0x in front. So 0x42 is hex, and 42 is decimal.
You can use the windows calculator. Put it in Programmer mode (because you are treading into i2c world, its programming)
load windows calculator
put in Programmer mode
select HEX mode
enter 42
select BIN mode
Notice 42 in HEX is 1000010 in binary. Notice it is only 7 bits long.
Let's shift the bits over by one. You can do that by either multiplying 42 x 2. Or simply type in BIN mode this: 10000100 (see, i put an additional 0 at the end LSB)
Now switch back to HEX mode once you have 10000100 entered in BIN mode
10000100 is 0x84 in HEX . So you would write to 0x84 on your i2c.
But for reading, you would set the LSB to a 1 rather than a 0 like we just did. So 10000100 is WRITE and 10000101 is READ.
Write = 10000100 = 0x84 Read = 10000101 = 0x85
Ok so great thanks for that, lol you are right im kinda kicking myself for not figuring that out, so onwards to the display, still nothing is happening in the data sheet they list that to send a command i need to use the following, , so listed to turn the display on and off is where 1 is on ans 0 is off, the command listed for the cmd bit in the datasheet is 0x91 to write to eprom , so in the ezb i tried
I2CStart() I2CWrite(0x84, 0x91, 0) to turn off the display (its on when power up)
or
I2cStart() I2CWrite(0x84, 0x91, 1) to turn it on
Nothing happens it doesnt even blink, kinda stuck with this now.... tried it many ways the dsiaply does work and my connection to the I2C bus seems ok when i press start on the script box the led on the ezb flashes for a millisecond but the display does nada. any ideas guys ?
Thanks Kurt
so i have contacted the manufacturer of this board and he said that 0x42 is the 8 bit address ? so anyways the email i have got from him is as follows ...
Kurt, no 0x42 is the 8 bit address, what you need is the text command for the display, something like start I2C (which is start condition followed by 0x42) send 0x20 write "hello" (which I assume sends 0x68 0x65 0x6c 0x6c 0x6f) stop I2C
See http://doc.byvac.com/index.php5?title=Product_BV4512 "Getting Started" which shows the commands required.
Jim
so by my assumption my ez b script should read...
I2CStart() I2CWrite(0x42, 0x20, "hello") I2CStop()
again this does nothing at all, his datasheet at the link above is like chinese to me lol i know i keep on about this but its the only I2C device i wanna use on the bot and the screen looks really really cool in the from of omnibot, for that and also debugging my program.. Any ideas
Kurt
Okies guys never mind i have sorted it, turns out i needed two more pull up resistors on the lines to get proper stable comms on the I2C device, what i faf anyways thanks soooo much for the help DJ it was invaluable as always :-)
Thanks Kurt
Sweet! The EZ-B has pull-ups, but sometimes the length of your wire (or device) requires additional. Let us know what ohm pull-ups you use to get it working. It'll help others.
You can try shortening the wire length to ~1 inch. That will probably prevent you from needing an additional pull-up.