I have a similar issue to the one posted here - Receiving Phone Number from Serial ht9032d CallerID - Programming Questions - Arduino Forum - except that I am not using a serial-to-computer link. I am trying to get this to work exactly as shown in their "tutorial" here - How to use Caller ID Module with Arduino | LinkSprite Learning Center - with the same LCD module. I have tried asking LinkSprite on their "tech support forum" but their only answer was "google it."
I don't have a lot of experience with Arduino, but I do know C (for programming the MSP430). I can pretty much follow along.
Having said that... When I hook the caller ID module (based on the HT9032 IC) RX pin to the RX pin as shown in the "wiring diagram" provided and load the supplied (undocumented) code, I get the "Test Code V1.0 - Waiting Caller .." display, but when a call comes in all I get is gibberish.
The code (from that "tutorial" page) is:
#include <LiquidCrystal.h>
#define LCD_BACKLIGHT_PIN 10
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
static int Ht9032_flag=0;
static int Ht9032_i=0;
static char Ht9032_code[25];
static int Ht9032_codeleng=0;
char SBUF0 = 0;
void setup()
{
pinMode(10,OUTPUT);
digitalWrite( LCD_BACKLIGHT_PIN, LOW );
delay(200);
lcd.begin(16, 2);
lcd.clear();
digitalWrite( LCD_BACKLIGHT_PIN, HIGH);
lcd.setCursor(0,0);
lcd.print("Test Code V1.0");
lcd.setCursor(0,1);
lcd.print("Waiting Caller..");
Serial.begin(1200);
delay(100);
}
void loop()
{
Ht9032_get();
}
void Serial_display()
{
for(int i=1;i<Ht9032_codeleng+1;i++)
{
Serial.print(char(Ht9032_code[i]));
Serial.print("/");
}
}
void lcd_display()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("DATE:");
lcd.print(char(Ht9032_code[1]));
lcd.print(char(Ht9032_code[2]));
lcd.print('/');
lcd.print(char(Ht9032_code[3]));
lcd.print(char(Ht9032_code[4]));
lcd.print(" ");
lcd.print(char(Ht9032_code[5]));
lcd.print(char(Ht9032_code[6]));
lcd.print(':');
lcd.print(char(Ht9032_code[7]));
lcd.print(char(Ht9032_code[8]));
lcd.setCursor(0,1);
lcd.print("NO.:");
for(int i=9;i<Ht9032_codeleng+1;i++)
{
lcd.print(char(Ht9032_code[i]));
}
}
void Ht9032_get()
{
while (Serial.available() > 0)
{
Serial.flush();
SBUF0 = Serial.read();
switch(Ht9032_flag)
{
case 0x00:if (SBUF0==0x55)
{
Ht9032_flag=0x01;
Ht9032_i=0x01;
}break;
case 0x01:if (SBUF0==0x55)
{
Ht9032_i++;
}
else
{
Ht9032_flag=0x00;
Ht9032_i=0x00;
}
if(Ht9032_i==0x0a)
{
Ht9032_flag=0x02;
Ht9032_i=0x00;
}break;
case 0x02:if(SBUF0==0x04)
{
Ht9032_flag=0x03;
}
else if(SBUF0==0x80)
{
Ht9032_flag=0x03;
}break;
case 0x03:Ht9032_codeleng = SBUF0;
Ht9032_i=0;
Ht9032_code[Ht9032_i++]=Ht9032_codeleng;
Ht9032_flag=0x04;
break;
case 0x04:Serial.print(Ht9032_code[Ht9032_i-1],HEX);
Ht9032_code[Ht9032_i++]=SBUF0;
if( Ht9032_i > Ht9032_codeleng+1 )
{
//Serial_display();
lcd_display();
Ht9032_flag=0x00;
Ht9032_i=0x00;
}
else
{ Ht9032_flag=0x04; }
break;
default:break;
}
}
}
Since the code is not well documented, I don't know what the case switches mean, but the [case 0x04] concerns me a bit since it's "printing" to the Serial port it would appear. Would the LCD module not work off pins 4-9 and 13? The TX line doesn't connect to the caller ID module. Why would it need to transmit anything out serially.
Any insight anyone could offer would be GREATLY appreciated. Thanks!