Sending text to GLCD using BV4511 interface


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Oct 2009
    Posts
    583

    Default Sending text to GLCD using BV4511 interface

    Hi,

    I picked up a 128 x 64 GLCD with a ByVac BV6511 adapter board that uses the I2C interface (web site http://www.byvac.com/index.php/BV4611)

    I'm totally confused....

    Reading the datasheet for the device it seems to suggest that you use the i2c much in the same way as you would a serial instruction. I was hoping it would be as simple as using the normal LCDOUT type instruction, along the lines of I2CWRITE, data pin, clock pin, address, control, ["hello world"]

    Looking at the datasheet even the address is confusing, page 4 gives it 0x32 (7 bit), 0x68 (8 bit). Page 5 states the default is 8 bit address of 0x68, but the 7 bit address is 0x34 ? I've tried using, substituting the $68 for $32 and $34 - no joy

    Code:
    I2cwrite SDA,SCL,$68,$0,[$27,"hello"]
    Can anyone who is good at deciphering data sheets have a look at it and let me know if this will work in PBP

  2. #2
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    I had a quick look at the DS.

    I think the address you want to use is $68. This is an 8bit I2C address.
    I'm pretty sure the reference to $32 7bit address on page 4 is a typo.
    In an 8bit address the uppermost 7bits is the actual address and bit 0 is the R/W bit.
    With I2Cwrite and I2Cread leave bit0 of the address set as a 0. PBP will deal with bit0 as needed.
    So $34 << 1 = $68
    %00110100 << 1 = %01101000

    I think the command you want to use is this:

    I2Cwrite SDA, SCL, $68,["hello"]

    The DS seems to indicate you do not need to send an escape char before text, just for commands. Btw the escape is dec 27 not hex 27.

    Also the controller wants the master to support clock stretching on the I2C bus so you would need to use the following PBP define.
    DEFINE I2C_HOLD 1

    Lastly, when you power up the controller, is the SDA bus line pulled high with a pull-up resistor?
    The controller needs to see SDA pulled high on power up to set I2C mode instead of serial mode.

    Hope I haven't sent you astray!
    Regards,
    TABSoft

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    On the contrary, helps me understand it a bit better.

    I have the LCD connected to a small solderless breadboard with 4 jumper wires +ve, GND, SDA and SCL. I have 5K6 resistors pulling SLC and SDA lines high. The breadboard is connected to the EasyPIC5 board via port C as C3 and C4 correspond to the i2C pins on the 18F4580 I'm using. When powered up the GLCD displays "ByVAC I2C", presumably confirming the mode it's set to (I've sought confirmation from the developer). I've created the following code based on the info in the above post

    Code:
    ; config settings 18F2550/4550/18F4580, running @ 40Mhz using 10mhz crystal 
    
    
    ASM  
      __CONFIG    _CONFIG1H, _OSC_HSPLL_1H
      __CONFIG    _CONFIG2L, _PWRT_ON_2L  
      __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
      __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
      __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    
    DEFINE I2C_HOLD 1
    
    DEFINE  OSC 40
    ADCON1 = $0F
    clear
    
    SDA var PORTC.4
    SCL VAR PORTC.3
    
    main:
    
    I2Cwrite SDA, SCL, $68,["hello"]
    pause 1000 
    Goto main
    This compiles OK but when squirted to the PIC the screen is not affected and still displays the "Byvac" message. -

    Here's me thinking that it would be as easy as using LCDOUT.....

  4. #4
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    It may be that the controller is programmed with a different I2C address.

    Here is a I2C Buss Scan program that Darrel Taylor created.
    I have modified it to suit my HW setup.
    I have used this many times very effectively.

    Maybe you can use this to scan the I2C Buss to determine the Address of the controller.

    I2CSearcher.txt

    Don't forget to change the file extension back to .bas or .pbp.

    I would use this to scan the buss and see if it shows up.
    If not, if you have a scope you can check the buss and see if it is working correctly.

    Lastly, the DS has a procedure to default the controller, you may want to try that as a last resort.
    Last edited by Tabsoft; - 30th May 2015 at 16:54.
    Regards,
    TABSoft

  5. #5
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Thanks for the test code. I've changed the parts to suit the PIC and Easypic board and compiled it without error.

    I am currently working on a project and have a breadboard with an DS1307 RTC chip connected to the EasyPIC5 board via the expansion port. On running the application it reported one device found and it's default address that matched that used in the project code. I then connected the GLCD and double checked the wires were correctly connected to the i2C bus. Upon running the PIC again (twice to be sure) I got the attached results !!

    I have no idea what's happening... my guess it that the board contains firmware that will only respond to serial codes or similar and not a normal i2c protocol - Resetting the board using the jumper wire has had no affect...
    Attached Images Attached Images  

  6. #6
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Could you try this?

    Modify the test code to print out the "Response" value coming back from the controller.
    E.g HEROUT [HEX2 Addr, " ", HEX2 Response, 13, 10]

    Then this?
    I2Cwrite SDA, SCL, $68, [$1b, "[", 1, ";", 1, "H"]
    I2Cwrite SDA, SCL, ["hello"]
    Regards,
    TABSoft

  7. #7
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    I found a similar sketch to test the i2c bus for an arduino.

    Code:
    / This sketch tests the standard 7-bit addresses
    // Devices with higher bit address might not be seen properly.
    When polled it reported one device found at 0x21

    I have no idea why when I do the same with the PBP code it reports 128 devices found at all the even addresss (0,2,4,6,8,0A,0C etc etc)

  8. #8
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    In the I2C search portion of the program do you have the ", NoAck" and the NoAck label?

    I2Cread SDA, SCL, ADDR, [Response], NoAck
    Blah
    Blah
    Blah

    NoAck:
    Next ADDR

    The ", NoAck" portion makes the I2Cread command wait for an ACK from the device. If an ACK is NOT received it jumps to the NoAck label where the ADDR variable is incremented. If an ACK IS received then the SlaveCount variable is incremented and the address is output telling you that that address responded.

    Also, do you have the DEFINE I2C_HOLD 1 statement still in there?
    The controller may need this clock stretching support.
    Regards,
    TABSoft

  9. #9
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Errr... No not used the NoAck

    To be honest given all this hassle and the way the datasheets don't help, I'm going to look for another device. I picked this up from e-bay for £12 (half the price of the current model) so I've not wasted a huge amount of cash.

    I appreciate you help

    Malcolm

  10. #10
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Oops.

    Yep, without the NoAck all even numbered addresses will report found because you're not testing for the ACK, which is exactly what it reported finding 128 devices.
    Regards,
    TABSoft

  11. #11
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Over the past few days I've been in correspondence with Tabsoft trying to resolve this issue. I'm now at a total loss, and I think even Tabsoft is baffled as the issue just doesn't make sense.

    The hardware:
    Easypic5, solderless breadboard, Arduino UNO, DS1307, 24C256 EEPROM, 18F4580, BV4512 board, FTDI USB board.

    Testing:
    Serial port monitor, Hantek 20mhz scope

    Basically running a simple code to scan the I2c buss and if any device is found to display it's address via the serial monitor. When using an identical script on the Arduino all three devices (DS1307, 24C256 and BV 4512 board is detected and their addresses displayed on the serial monitor. Running the equivalent code on the PIC it finds the DS1307 and 24C256 fine, but when the BV board is connected the PBO code detects a poor response on the buss and displays a "fault" message.

    Using the scope the normal 9 pulses can be seen on both Arduino and PIC when just the two devices are running, but when testing with the PIC, both SDA and CLK lines are taken to GND when the BV board is connected.

    Thinking that it may be something to do with the EasyPIC5 board the PIC was programmed and then moved to the breadboard next to the DS1307 and 24C256 chips. The same issue occurred so this eliminated the EasyPic5 board as being the cause. I've tried 10K, 5.6K, 4.7K, and 1K pull-ups on the i2c buss lines, but that makes no difference.

    Anyone have any ideas of further things to try?

    I would like to thank tabsoft for all his help. We've been corresponding via e-mail, often with me doing the practical testing, and reporting back with screen shots etc so we can try and resolve this. The only issue being that due to locations (he's in the US and I'm in the UK) it's often meant that I'm up until 3am most mornings and now I'm walking around like a zombie !!

  12. #12
    Join Date
    Oct 2011
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Hi Scampy
    You say when testing with PIC, SDA and CLK lines are taken low when BV4611 is connected. According to the data sheet this will cause the BV4611 to start up in SERIAL mode. Have you set the PIC to pull SDA & CLK LOW or are they HIGH untill you connect the BV4611? Do you have the PIC start up with SDA & SCK as inputs untill the BV4611 starts up?
    Surely SDA and SCK should idle HIGH.
    Phil
    By the way I'm in the UK

  13. #13
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Hi Phil,

    the device I have is the older 4512, which is now obsolete and replaced by the 4611, which I've been told by Jim (the developer) is a "better" device. Tabsoft has managed to get the device responding to a poll from the PIC. It's complicated, but lest just say the Arduino and it's programming language sticks to the true correct protocol of the i2c standard, where as PBP appears to use an abbreviated version which mainstream devices can tolerate, but the BV4511 doesn't.

    I'm also testing the GLCD as I may of damaged it when I connected it to the EasyPic5 board. On the EP5 the CS1 and CS2 are at one end of the header, but on the GLCD pins 15 and 16 are CS pins, so everything is then out by 2.... I need to do some further testing to make sure the GLCD works (going to fly wire to the correct pins one for one when the wires arrive). Once that has been checked and i can confirm it works then the fun begins in trying to get the BV4512 to receive and correctly interpret the PBP instructions to display text correctly....

    If only someone manufactured an 8 x 20 LCD with built in character set based on the standard HD chipset... life would be a lot simpler... but then I guess PBP would only support LCD's up to 4 x 20.

    I'm not going to post up the PBP code as Tabsoft is the main contributor, but I'm sure that once we have resolved this it will be put up for reference should some other poor soul happens to have one of these boards and wants to code in PBP

  14. #14
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Received a 128 x 64 GLCD with touch screen from MikroElektronica that works fine with the EasyPic5 demo - so I know it's working.

    Breadboarded the BV controller to the GLCD carefully noting the pin mapping as the Mikro screen does not use the same pin outs as the board. It powers up, displayed the default message and I can turn off the screen and backlight by sending the appropriate code and value to the I2C address

    Code:
     BVCmd = $6
    opt=1
    
    i2cwrite SDA,SCL, BVAddr ,BVcmd,opt
    But trying to produce anything graphical like turning on pixels or drawing boxes fails so I tried my other piggyback board. It to powers up, displays it's demo screens. However reading the limited "manual" (http://www.digole.com//images/file/T...ter-Manual.pdf) it doesn't have the same type of command set, more for hyperterminal....

    Would welcome suggestions as to how to configure this puppy to use it's internal fonts to give me the equivalent of an 8 x 20 LCD as I've not only gone grey with this, but now getting bald

  15. #15
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Sending text to GLCD using BV4511 interface

    Ok I gave up with the BV4512 board and the I2C connectivity of the Digole board, and stested the Digole board in default serial mode.

    It took a while but it works.

    Having the built in selectable fonts makes this behave as if it was a large LCD - which for now is what I'm after.
    Attached Images Attached Images  

Similar Threads

  1. Replies: 1
    Last Post: - 4th June 2010, 03:34
  2. How to prepare text (lots of text) for HSEROUT ?
    By Byte_Butcher in forum General
    Replies: 0
    Last Post: - 15th February 2010, 22:31
  3. Glcd
    By buddhafragt in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th August 2009, 18:58
  4. Glcd
    By Sphere in forum General
    Replies: 0
    Last Post: - 26th August 2006, 17:48
  5. Help with sending text file from pic
    By isaac in forum Serial
    Replies: 6
    Last Post: - 15th August 2006, 20:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts