Welcome! Log In Create A New Profile

Advanced

Interfacing Arduino UNO R3 to BV4639

Posted by fcapozzi 
Interfacing Arduino UNO R3 to BV4639
March 03, 2013 11:20PM
Hi all, i have a BV4639 LCD chip interface but i was unable to estabilish communication with the chip from Arduino.

I made this connections

BV-pin14 to +5v
BV-pin04 to +5v
BV-pin01 to GND
BV-pin5(Rx) to Arduino pin 4(Tx)
BV-pin6(Tx) to Arduino pin 5(Rx)

Using as reference document this link [pic32.byvac.com]
i run the Arduino Sketch suggested to poll any ASI devices. I got only the "Devices" print but no other letter
show up.

I experimenting inverting TX and RX pin but with no fortune.
What wrong ?

Tnx in advance.

==================================================================
#include <BSerial.h>
#include <ASI.h>

#define rxPin 5
#define txPin 4

ASI asi(rxPin, txPin);

void setup() {
Serial.begin(9600); // to show results from example
asi.baud(9600);
asi.begin();
}

void loop() {
char b[20];
Serial.print("\nDevices ");
asi.devices(b,19);
Serial.println(b);
while(1); // stop
}
==================================================================
Re: Interfacing Arduino UNO R3 to BV4639
March 04, 2013 09:34AM
hello,
the BV4629 is not an ASI device but an SV3 (serial version 3) device and so works a bit differently so the libraries for the ASI will not work with this IC. As yet there are no Arduino libraries for SV3, just Python code as it was expected to be used with the PRi initially.

To be honest I forgot about the Arduino (shame on me). You can have a go at writing a library yourself, it should be similar to the ASI library but with some subtle differences. If not I should have one done by the middle of next week and will post it with the other Arduino libraries.
Re: Interfacing Arduino UNO R3 to BV4639
March 05, 2013 09:55PM
Just to experiment a bit waiting for your library i made this simple experiment. I just used Bserial library and send continous carriage returns waiting for the * to come out in response. as directed in the datasheet. Look at the code. During execution Arduino never reach the "done" statement. So maybe i done something wrong. Connections are the same as in the previous post.



#include <BSerial.h>

#define rxPin 5
#define txPin 4

BSerial bs(rxPin, txPin);

void setup() {
Serial.begin(9600);
bs.baud((long)9600);
bs.flush();
}

void loop() {
char ch;
ch=0x00;
Serial.print("Connecting...");
while (ch !=0x2a) { // Here looking for *
bs.putch(0x0d); // Send \r
delay(50);
ch=bs.getch();
}
Serial.print(" Done\n");
Re: Interfacing Arduino UNO R3 to BV4639
March 06, 2013 07:49AM
Something that will help: The data sheet is wrong V+ is pin 14 and GND is pin 1, no damage occures getting them the wrong way round.
The data sheet has now been corrected.
Re: Interfacing Arduino UNO R3 to BV4639
March 06, 2013 09:15AM
I saw the new data sheet now ... should be Pin 1 Vcc and Pin 14 is GND. The position is correct in the data sheet but pin numbering is wrong since according the ic pinout the first pin on the left is 1 and not 14 as reported. This is confirmed reading the PIC16F1824 original datasheet
Ok, i'do some more test asap. :)
Re: Interfacing Arduino UNO R3 to BV4639
March 06, 2013 07:08PM
Finaly i got the chip running but i still have some questions.

First i used this pin connection

BV pin 1 to +5V
BV pin 4 to GND // read note at the end
BV pin 14 to GND
BV pin 5(rx) to Arduino Uno pin 4(tx)
BV pin 4(tx) to Arduino Uno pin 5(rx)

This is the test program

#include <BSerial.h>

#define rxPin 5
#define txPin 4

BSerial bs(rxPin, txPin);
long brate;

void setup() {
  Serial.begin(9600);
  bs.flush();
  brate=9600;
  bs.baud(brate);
}

void loop() {
    int i=0;
    char ch;
    ch=0x00;
    Serial.print("Connecting...");
    while (ch !=0x2a) {
         bs.putch('\r');
         delay(50);
         if(bs.buffer()!=0) {
            ch=bs.getch();
            Serial.print(ch);
            bs.flush();
         }
    }
    Serial.print("  Done\n");
    
    i=0;
    while(1) {
      bs.puts("bdJKL\r");
      if (bs.buffer() !=0) { 
          Serial.print((int)bs.getch());
          i+=1;
          if (i==40) { 
             Serial.print("\n");
             i=0;
          }
      }
    }
}
And this is the output of the program execution

Connecting...*  Done
0000000000000000000000000000000200000000
0000000000000000000000001000000000000000
0000000000000000010000000000000000000000
0000000000200000000000000000000000000000
0002000000000000000000000000000000001000
0000000000000000000000000000010000000000
0000000000000000000000200000000000000000
0000000000000002000000000000000000000000
0000000010000000000000000000000000000000
0100000000000000000000000000000000200000
0000000000000000000000000002000000000000
0000000000000000000010000000000000000000
0000000000000100000000000000000000000000
0000002000000000000000000000000000000002
0000000000000000000000000000000010000000
0000000000000000000000000100000000000000
0000000000000000002000000000000000000000
0000000000120000000000000000000000000000
0000100000000000000000000000000000000100
0000000000000000000000000000002000000000
As you can see the chip answered with * and the i begin sending the command "bdJKL\r" since b is the default chip address.
In response to each command i was expecting a * as reported in the datasheet but instead i got 0 or sometimes 1 or 2.
I wonder if this behaviour is normal or not.

Note: The datasheet state that the pin4 (F) of the BV chip should be tied to 5V. Doing so the chip wont work. But if i tie the F pin to the ground the chip start. Is there an other error in the datasheet or what ?
Re: Interfacing Arduino UNO R3 to BV4639
March 07, 2013 07:53PM
First things first. The hardware is:
Pin 1 V+
Pin 14 GND
Pin 4 V+ <<< Very important.

There is now an Arduino library that can be found on this page. On the page there is also the SV3 and BSerial libraries that will also be needed. The example is:

#include <BSerial.h>
#include <sv3.h>
#include <bv4639.h>

#define rxPin 5
#define txPin 4

BV4639 disp(rxPin, txPin, 9600, 'b', 6);

void setup()  {
  disp.init();
}

void loop() {
char buf[40];
int j;
  disp.cls();
  disp.print("Hello ");
  disp.print(22);
  disp.print(77," 0x%x");
  j=disp.id();
  disp.rowcol(1,0);
  disp.print(j);
  disp.firmware(buf);
  disp.print(" Version:");
  disp.print(buf);

  while(1); // stop
}

This will work with the default settings where the address is 'b', it will also work with Baud rates up to 115200 if required. This sketch expects TX and RX to be on the digital pins as shown.
Re: Interfacing Arduino UNO R3 to BV4639
July 26, 2013 08:31PM
hello

I have buy one serial adapter and i can not print one variable with two decimals
here is the code
un adapter print byvac 4109 version 1

float tempC = sensors.getTempC(insideThermometer);
disp.print(" T ");
disp.print(tempC);

disp.rowcol(1 ,15);
disp.print ("C");

tempC is one value transmited for the DallasTemperature sensors


when conect the lcd direct i have temperature (exemple 26,25 c)
and with serial adapter i can print only 26 c

please help me !



Edited 1 time(s). Last edit at 07/26/2013 08:33PM by daber.
Re: Interfacing Arduino UNO R3 to BV4639
July 27, 2013 08:45AM
try:
disp.print("tmp=%f",tempC);
Of course tempC will be a double for float variable to be able to store decimal places.
Re: Interfacing Arduino UNO R3 to BV4639
December 01, 2013 12:15PM
Thank you jimeer ,

but with this code i have thios error
"error: no matching function for call to 'BV4639::print(const char [7], float&)'"
I have solucion

void printTemperature(DeviceAddress deviceAddress)
{

sensors.requestTemperatures();
/delay(750);

float tempC = sensors.getTempC(deviceAddress);
char tempC1[5];
dtostrf(tempC, 5, 2, tempC1);

disp.print("T:");
disp.print(tempC1);
disp.print(" C");
}



Edited 1 time(s). Last edit at 12/01/2013 08:17PM by daber.
Sorry, only registered users may post in this forum.

Click here to login